Topic
2 replies Latest Post - ‏2012-12-12T17:22:02Z by bourne
SystemAdmin
SystemAdmin
37426 Posts
ACCEPTED ANSWER

Pinned topic Websphere Application Server logging not working?

‏2012-12-08T18:25:23Z |
Hi,

I'm fairly new to WAS and am trying to debug an application that works on Tomcat. I'm using both System.out.println's and log4j logging. If I use the WAS Admin Console, it only shows me logging from a day earlier, no logging from activity that happened just now.

Additionally, if I use Windows Explorer to search for recently modified log files or log files that have special keywords that I'd expect in the logging, I don't turn up any recent log results. I only see old log results.

Do you have any suggestions?
Updated on 2012-12-12T17:22:02Z at 2012-12-12T17:22:02Z by bourne
  • SystemAdmin
    SystemAdmin
    37426 Posts
    ACCEPTED ANSWER

    Re: Websphere Application Server logging not working?

    ‏2012-12-08T18:54:24Z  in response to SystemAdmin
    WAS's logging can be a bit odd.

    First... regarding the file system and Windows Explorer. When WAS writes out to the log file, the log file time often isn't updated to a new time until the file is closed. That means if you're searching the tree for a recently modified file in order to find the proper log file that is being used, you're not going to find it since it probably will be dated a while earlier. The file probably ....\SystemOut.log and not one of the files that has a date in the name of the file. -- Also of note, if you use Windows Explorer to find the file containing a certain keyword that your logging produces, it often won't find it in the current log file. It seems that often Windows Explorer's find facility will only find it once the file is closed. (Perhaps it only notices changes once the modification date of a file changes.)

    Second... regarding the WAS admin console logging pages. First, for others reading this post that have never found them, you'll want to follow the following click stream:
    Left Nav: Troubleshooting -> Logs and trace
    -> Pane: <name of your server> ((if you don't know, try a few))
    -> JVM Logs
    -> Tab: "Runtime"
    -> System.out's "View" button (Note... you can also specify older logs here but get the latest if you don't select)
    Now you're looking at the log files, but you should be aware that you're only looking at a portion of the log file. By default the WAS AC seems to only list the top few lines of the console, which are probably not what you want. No, you can't just scroll down to the bottom to see the most recent lines either. You must enter something like 1-50111 to list the whole file. (If the file is big, you might need a bigger number than 50111.) You might be tempted to make this faster by entering something like 40000-50000, but you should be aware that if you do this and the file is less than 40k lines long, you'll probably instead see the top few lines of the log file instead of what you intended... and there will be no warning message to alert you of this. I know of no way to request something like the last 5k lines without knowing how many lines there are in the log file. I also don't think it supports tailing.

    I learned all this the other day after much frustration and am thinking of building a log viewer servlet that saves me from most of these steps and potential surprises.

    I hope this helps. Good luck.
  • bourne
    bourne
    2 Posts
    ACCEPTED ANSWER

    Re: Websphere Application Server logging not working?

    ‏2012-12-12T17:22:02Z  in response to SystemAdmin
    First, let me say that I'm assuming you are not using the Liberty profile, and are instead using full profile WAS. Assuming that is true...

    Your System.out.println's should show up in the SystemOut.log file in appserver\profiles\profileName\logs\serverName (eg. D:\WAS85\profiles\AppSrv01\logs\server1). If you are able to access the file system, it's easier to look directly at the file with your editor of choice than to view the log in the admin console, for the reasons mentioned by benimble4.

    If you are running with WAS V8.0 or later, you can take advantage of High Performance Extensible Logging (HPEL), which has a number of usability improvements to make log viewing via the admin console better. You will see a button in your admin console at the Troubleshooting > Logs and Trace panel to turn on HPEL (a server restart is required for the server to pick up this new configuration info). Once you are using HPEL, you can go to Troubleshooting > Logs and Trace > serverName > View Logs and Trace to see the log/trace content in a much nicer UI than what is there for SystemOut.log. With HPEL enabled, your logs and trace will be in the same appserver\profiles\profileName\logs\serverName directory, but will be called TextLog*.log. Note that only the log/trace/System.out content you create after you've switched to HPEL will be available in the HPEL UI or the TextLog*.log.

    You mentioned you are using log4J. log4J's log content is not integrated into the WAS logs (unless you use something like SLF4J to write the log4J requests to java.util.logging). As such, you'll need to look for your log4J content wherever you have configured log4J to put it.

    Don