Pivotal Knowledge Base


How to Identify STDOUT and STDERR Application Logs on External Logging Service


Pivotal Cloud Foundry® (PCF) 1.6.x and 1.7.x


This article explains how to identify STDOUT and STDERR application logs on external logging services. 


Embed Java test code into the Java sample application and cf push to PCF.

System.out.println("This is stdout message!");
System.err.println("This is stderr message!");

"ERR" and "OUT" are inserted into the cf logs <APP_NAME> output

2015-11-17T12:25:30.46+0900 [APP/0] ERR This is stderr message!
2015-11-17T12:25:30.46+0900 [APP/0] OUT This is stdout message!

"ERR" and "OUT" are not appended to the log when being exported to the external logging service. Instead, as in the example below, syslog priority code is used to identify "stdout" and "stderr"; priority value 14 corresponds to a user-level informational message and 11 corresponds to a user-level error message.

11/18/2015 10:51:04.007 <14>1 2015-11-18T01:51:04.007737+00:00 loggregator 465f645f-5948-45d5-a12c-bc85de6b87f6 [APP] - -

This is stdout message.

Host: xxx.xxx.xxx.xxx Name: Http Input Category: Http Input 

11/18/2015 10:51:04.007 <11>1 2015-11-18T01:51:04.007862+00:00 loggregator 465f645f-5948-45d5-a12c-bc85de6b87f6 [APP] - - This is stderr message!
Host: xxx.xxx.xxx.xxx Name: Http Input Category: Http Input

Additional Information

The priority value of syslog is defined in RFC5424, Section-6.2.1.


Powered by Zendesk