Control logging level by WebSphere admin console
Asked Answered
C

2

6

I have a web application in which I am using java.util.logging. In my logging.properties files default level is info. I have loggers in my application for all levels of logging (info, debug, fatal etc). This web application will be deployed on WebSphere 8.

What if I want to change logging level, lets say from info to error, of application through WAS admin console at runtime? How can I achieve this?

Cincinnati answered 30/9, 2014 at 6:56 Comment(0)
A
6

In addition to Magic Wand answer:

  • Changes on the Configuration tab are valid after server restart
  • Changes on the Runtime tab are valid only till server restart unless you checked Save runtime changes to configuration as well
  • You can either type your trace string in the text area, or select it using the Components tree (your packages may not be visible, if classes were not loaded yet)
  • All messages with levels fine, finer, finest will go to the trace.log not to the SystemOut.log.
Antiquate answered 30/9, 2014 at 12:1 Comment(0)
C
5

Log into WAS Admin console and click on Troubleshooting->Logs and trace->your server->Diagnostic trace service->Change log level details.

There you can add your own log levels, e.g.

com.example.test.*=all

You can change it permanently, or you can change log levels dynamically on runtime (tab "Runtime"). Log levels are separated with ':'.

Contemptible answered 30/9, 2014 at 8:59 Comment(3)
I have tried this option. Problem is it controls the log of WAS server. I want to control log of my application which is getting generated in myapp.log file.Cincinnati
Is there any way to do this from a configuration file or something like that? I can't access the admin console so my only option is changing it from the file system.Lesko
There is an option to do it via a jython script, which basically boils down to run a shell script on a WAS server directly. More details about log level change via a jython script can be found on #12383913. Moreover, you can run wsadmin script from your computer on a remote WAS instance, details can be found here: ibm.com/support/knowledgecenter/en/SSAW57_7.0.0/…Contemptible

© 2022 - 2024 — McMap. All rights reserved.