MessageLogging policy : Why am I seeing empty files ?

I am using the following MessageLogging policy in my PrivateCloud 4.17.05 setup:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MessageLogging async="false" continueOnError="false" enabled="true" name="requestLog">
    <DisplayName>requestLog</DisplayName>
    <File>
        <Message>This is my test message</Message>
        <FileName>test.log</FileName>
        <FileRotationOptions rotateFileOnStartup="true">
            <FileRotationType>SIZE</FileRotationType>
            <MaxFileSizeInMB>10</MaxFileSizeInMB>
            <MaxFilesToRetain>10</MaxFilesToRetain>
        </FileRotationOptions>
    </File>
    <logLevel>DEBUG</logLevel>
</MessageLogging>

After I make some API calls to the API Proxy having this policy, I notice that the file test.log is created but it is empty as shown below:

[adevegowda@karl-opdk-aio-1709 requestLog]$ ls -l
total 4
-rw-r--r--. 1 apigee apigee 0 Nov  8 14:32 test.log

Can you please let me know why am I getting empty file ?

Solved Solved
0 1 259
1 ACCEPTED SOLUTION

I checked the MessageProcessor's system.log and found the following exception:

2017-11-08 14:20:31,562 org:myorg env:prod api:TestMessageLogging rev:5 messageid:karl-opdk-aio-1709-8655-8514-1 policy:requestLog NIOThread@0 ERROR S.MESSAGE_LOGGING - MessageLogger.log() : Error while executing stepDefinition [requestLog].
java.lang.NullPointerException: null
        at com.apigee.steps.messagelogging.MessageLogger.getLogLevel(MessageLogger.java:125) [message-logging-1.0.0.jar:na]
        at com.apigee.steps.messagelogging.MessageLogger.logToDestination(MessageLogger.java:121) [message-logging-1.0.0.jar:na]
        at com.apigee.steps.messagelogging.MessageLogger.log(MessageLogger.java:88) [message-logging-1.0.0.jar:na]
        at com.apigee.steps.messagelogging.MessageLogger.execute(MessageLogger.java:56) [message-logging-1.0.0.jar:na]
        at com.apigee.messaging.runtime.steps.StepExecution.execute(StepExecution.java:146) [message-processor-1.0.0.jar:na]
        at com.apigee.flow.execution.SyncExecutionStrategy.execute0(SyncExecutionStrategy.java:57) [message-flow-1.0.0.jar:na]
        at com.apigee.flow.execution.SyncExecutionStrategy.execute(SyncExecutionStrategy.java:39) [message-flow-1.0.0.jar:na]
        at com.apigee.flow.MessageFlowImpl.execute(MessageFlowImpl.java:428) [message-flow-1.0.0.jar:na]
        at com.apigee.flow.MessageFlowImpl.resume(MessageFlowImpl.java:314) [message-flow-1.0.0.jar:na]
        at com.apigee.flow.execution.ExecutionContextImpl$1.run(ExecutionContextImpl.java:96) [message-flow-1.0.0.jar:na]
        at com.apigee.nio.NIOSelector.runTasks(NIOSelector.java:363) [nio-1.0.0.jar:na]
        at com.apigee.nio.NIOSelector.access$000(NIOSelector.java:34) [nio-1.0.0.jar:na]
        at com.apigee.nio.NIOSelector$2.findNext(NIOSelector.java:311) [nio-1.0.0.jar:na]
        at com.apigee.nio.NIOSelector$2.findNext(NIOSelector.java:302) [nio-1.0.0.jar:na]
        at com.apigee.nio.util.NonNullIterator.computeNext(NonNullIterator.java:21) [nio-1.0.0.jar:na]
        at com.apigee.nio.util.AbstractIterator.hasNext(AbstractIterator.java:47) [nio-1.0.0.jar:na]
        at com.apigee.nio.handlers.NIOThread.run(NIOThread.java:96) [nio-1.0.0.jar:na]

So I suspected that something is incorrect within the MessageLogging policy. I rechecked the MessageLogging policy documentation and found that the loglevel was incorrectly set as DEBUG which is not an allowed option.

logLevel 
Valid values: INFO (default), ALERT, WARN, ERROR 

I changed the logLevel as INFO in the MessageLogging policy and I started seeing the messages being logged to test.log file.

View solution in original post

1 REPLY 1

I checked the MessageProcessor's system.log and found the following exception:

2017-11-08 14:20:31,562 org:myorg env:prod api:TestMessageLogging rev:5 messageid:karl-opdk-aio-1709-8655-8514-1 policy:requestLog NIOThread@0 ERROR S.MESSAGE_LOGGING - MessageLogger.log() : Error while executing stepDefinition [requestLog].
java.lang.NullPointerException: null
        at com.apigee.steps.messagelogging.MessageLogger.getLogLevel(MessageLogger.java:125) [message-logging-1.0.0.jar:na]
        at com.apigee.steps.messagelogging.MessageLogger.logToDestination(MessageLogger.java:121) [message-logging-1.0.0.jar:na]
        at com.apigee.steps.messagelogging.MessageLogger.log(MessageLogger.java:88) [message-logging-1.0.0.jar:na]
        at com.apigee.steps.messagelogging.MessageLogger.execute(MessageLogger.java:56) [message-logging-1.0.0.jar:na]
        at com.apigee.messaging.runtime.steps.StepExecution.execute(StepExecution.java:146) [message-processor-1.0.0.jar:na]
        at com.apigee.flow.execution.SyncExecutionStrategy.execute0(SyncExecutionStrategy.java:57) [message-flow-1.0.0.jar:na]
        at com.apigee.flow.execution.SyncExecutionStrategy.execute(SyncExecutionStrategy.java:39) [message-flow-1.0.0.jar:na]
        at com.apigee.flow.MessageFlowImpl.execute(MessageFlowImpl.java:428) [message-flow-1.0.0.jar:na]
        at com.apigee.flow.MessageFlowImpl.resume(MessageFlowImpl.java:314) [message-flow-1.0.0.jar:na]
        at com.apigee.flow.execution.ExecutionContextImpl$1.run(ExecutionContextImpl.java:96) [message-flow-1.0.0.jar:na]
        at com.apigee.nio.NIOSelector.runTasks(NIOSelector.java:363) [nio-1.0.0.jar:na]
        at com.apigee.nio.NIOSelector.access$000(NIOSelector.java:34) [nio-1.0.0.jar:na]
        at com.apigee.nio.NIOSelector$2.findNext(NIOSelector.java:311) [nio-1.0.0.jar:na]
        at com.apigee.nio.NIOSelector$2.findNext(NIOSelector.java:302) [nio-1.0.0.jar:na]
        at com.apigee.nio.util.NonNullIterator.computeNext(NonNullIterator.java:21) [nio-1.0.0.jar:na]
        at com.apigee.nio.util.AbstractIterator.hasNext(AbstractIterator.java:47) [nio-1.0.0.jar:na]
        at com.apigee.nio.handlers.NIOThread.run(NIOThread.java:96) [nio-1.0.0.jar:na]

So I suspected that something is incorrect within the MessageLogging policy. I rechecked the MessageLogging policy documentation and found that the loglevel was incorrectly set as DEBUG which is not an allowed option.

logLevel 
Valid values: INFO (default), ALERT, WARN, ERROR 

I changed the logLevel as INFO in the MessageLogging policy and I started seeing the messages being logged to test.log file.