Pivotal Knowledge Base


Unable to view logs with the cf command line utility


You are trying to view the logs from your application using the cf command line utility, but you are not seeing them or you are getting an error.

$ cf logs <app> 
Connected, tailing logs for app <app> in org <org> / space <space> as <user>...


$ cf logs <app> --recent 
websocket.Dial wss://loggregator.run.pivotal.io:4443/dump/?app=<app-guid>: <error>


When it comes to logging problems, there are a few possible causes.  See the sections below for details.

General Network Issues

The first thing to check are general network issues.  If you're seeing an error message which indicates could not resolve host or host or network not reachable, this is likely indicating that there is a general network problem.  Check that you can successfully connect to the Internet and that if you are behind a network proxy, you have correctly configured the cf utility to be aware of the proxy.  Instructions for proxy setup can be found here.

Upgrade Required

In some cases, you'll see an error bad status from the cf utility.  In this case, check the version of the cf utility that you're using by running this command.

cf -v

The output should indicate the version number.  Confirm that you are running that latest version of the utility as older versions may become incompatible as the infrastructure for PWS is upgraded.  You can find the latest version of the cf utility here.

Incorrect Command Usage

Logs that are captured from your application by PWS can be viewed in two different ways.  Either by running cf logs <app> or cf logs --recent <app>.  It is important to understand how these commands work, as there are legitimate cases where you may see no logs.

The first command, cf logs <app>, will stream any new log entries as they are generated by your application.  This will show the logs as they are occurring and is often called tailing.  It will not provide you with any logs that were generated by the application prior to you starting the command.  If you need past logs, see the next paragraph.

The second command, cf logs --recent <app>, will display logs that were recently generated by your application.  There is no strict definition for recent, but this can generally be though of as within the last few minutes.  It may be less though, if your application is generating a large amount of log entries.

For the cases where you need to maintain a complete set of logs, you would not want to depend on the output from cf logs.  Instead you should use a third party log management system.  Instructions for enabling that can be found here.

Application Log Configuration

When your application runs, PWS will capture anything that is written to STDOUT or STDERR.  These messages form the logging that you see when you run cf logs.  If your application is not configured to send it's logs to STDOUT or STDERR (sometimes call Console), then it's logging will not be visible via cf logs.

If you are not seeing log entries when running cf logs, you should check to confirm that your application is correctly configured to log to STDOUT or STDERR.  If the application is configured to log to a file, the logging output will not show up in cf logs.

Additional Information

More general information on logging can be found in the documentation here.


Powered by Zendesk