We have the following Message Logging policy in one of our API Proxies where the FormatMessage element is set to true:
<MessageLogging name="LogPolicy" async="true" continueOnError="true" enabled="true"> <Syslog> <Message>[apigee_org="{organization.name}" apigee_proxy="{apiproxy.name}" apigee_env="{environment.name}"] example message here</Message> <Host>host.example.com</Host> <Port>9000</Port> <Protocol>TCP</Protocol> <FormatMessage>true</FormatMessage> </Syslog> <logLevel>INFO</logLevel> </MessageLogging>
In the Message Processor log files, we are seeing the following error:
org:myorg env:test api:ExampleProxy rev:2 messageid:<hostname>-52825-3296914-3 Apigee-Main-2 ERROR S.MESSAGE_LOGGING - MessageLogger$2.run() : Unable to log to destination! java.lang.IllegalArgumentException: Illegal pattern character 'T' at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:826) ~[na:1.8.0_171] at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:634) ~[na:1.8.0_171] at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:605) ~[na:1.8.0_171] at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:580) ~[na:1.8.0_171] at com.apigee.syslogger.SysLogger.logStructured(SysLogger.java:126) ~[syslog-1.0.0.jar:na] at com.apigee.syslogger.SysLogger.log(SysLogger.java:95) ~[syslog-1.0.0.jar:na] at com.apigee.messaging.runtime.destinations.SyslogDestination.log(SyslogDestination.java:69) ~[message-processor-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.access$200(MessageLogger.java:31) ~[message-logging-1.0.0.jar:na] at com.apigee.steps.messagelogging.MessageLogger$2.run(MessageLogger.java:76) ~[message-logging-1.0.0.jar:na] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_171] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_171] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_171] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_171] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]
If we set FormatMessage element to false, then it works fine without any errors. Any thoughts what might cause this exception?
Solved! Go to Solution.
Found that this is caused due to a bug, where invalid timestamp is generated in messages sent via MessageLogging policy.
To fix this, added following line in /opt/apigee/customer/application/message-processor.properties
conf_system_apigee.syslogger.dateFormat=yyyy-MM-dd'T'HH:mm:ss.sssZ
and restart message-processors. This resolved the issue.
Found that this is caused due to a bug, where invalid timestamp is generated in messages sent via MessageLogging policy.
To fix this, added following line in /opt/apigee/customer/application/message-processor.properties
conf_system_apigee.syslogger.dateFormat=yyyy-MM-dd'T'HH:mm:ss.sssZ
and restart message-processors. This resolved the issue.