Search This Blog

Tuesday, 16 December 2014

View application log files in PCF using the CF CLI

I recently setup verbose GC logging on a  deployed application to Pivotal Cloud Foundry (PCF) and specified a file to write the GC logging info to. Below shows how you can view application files using the CF CLI.

1. Start by invoking the following to show your deployed applications

[Tue Dec 16 09:32:10 papicella@:~/cf/APJ-vcloud ] $ cf apps
Getting apps in org ANZ / space development as pas...
OK

name                  requested state   instances   memory   disk   urls
pas-playjava          started           1/1         512M     1G     pas-playjava.apj.fe.pivotal.io
pcfhawq               started           1/1         512M     1G     pcfhawq.apj.fe.pivotal.io
apples-spring-music   started           1/1         512M     1G     apples-spring-music.apj.fe.pivotal.io
pas-petclinic         started           1/1         512M     1G     pas-petclinic.apj.fe.pivotal.io

2. Now lets view the files for the application

[Tue Dec 16 09:33:29 papicella@:~/cf/APJ-vcloud ] $ cf files apples-spring-music
Getting files for app apples-spring-music in org ANZ / space development as pas...
OK

.bash_logout                              220B
.bashrc                                   3.0K
.profile                                  675B
app/                                         -
logs/                                        -
run.pid                                     3B
staging_info.yml                          495B
tmp/                                         -

3. Now lets view the contents of a specific file by providing the full path to the file, in this case our GC log file.

[Tue Dec 16 09:33:41 papicella@:~/cf/APJ-vcloud ] $ cf files apples-spring-music /app/apples_gc.log
Getting files for app apples-spring-music in org ANZ / space development as pas...
OK

OpenJDK 64-Bit Server VM (25.40-b06) for linux-amd64 JRE (1.8.0_25--vagrant_2014_10_17_04_37-b17), built on Oct 17 2014 04:40:49 by "vagrant" with gcc 4.4.3
Memory: 4k page, physical 16434516k(1028892k free), swap 16434488k(16434476k free)
CommandLine flags: -XX:InitialHeapSize=391468032 -XX:MaxHeapSize=391468032 -XX:MaxMetaspaceSize=67108864 -XX:MetaspaceSize=67108864 -XX:OnOutOfMemoryError=/home/vcap/app/.java-buildpack/open_jdk_jre/bin/killjava.sh -XX:+PrintGC -XX:+PrintGCTimeStamps -XX:ThreadStackSize=995 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC
1.522: [GC (Allocation Failure)  95744K->16737K(367104K), 0.0590876 secs]
1.786: [GC (Allocation Failure)  112481K->23072K(367104K), 0.0735813 secs]
2.075: [GC (Allocation Failure)  118816K->32499K(367104K), 0.0531070 secs]
2.315: [GC (Allocation Failure)  128243K->45124K(367104K), 0.0428136 secs]
2.893: [GC (Allocation Failure)  140868K->53805K(367104K), 0.0375078 secs]
4.143: [GC (Allocation Failure)  149549K->63701K(335360K), 0.1507024 secs]
5.686: [GC (Allocation Failure)  127701K->69319K(331776K), 0.0703850 secs]
7.060: [GC (Allocation Failure)  133319K->70962K(348672K), 0.0121269 secs]
8.458: [GC (Allocation Failure)  130866K->69734K(322560K), 0.0228917 secs]

No comments: