Results 1 to 5 of 5

Thread: Dynamically changing logging level?

  1. #1
    Join Date
    Feb 2007
    Posts
    13

    Default Dynamically changing logging level?

    I deploy an application to servers using an EAR file. Most all of the documentation for changing the logging level involves modifying the XML, which in my case is a lengthy redeploy via EAR, which also restarts the server.

    So, without changing the XML configuration files, how do you change the logging level?

  2. #2
    Join Date
    Feb 2007
    Posts
    13

    Default

    My best guess at the moment is:

    for each (log in LogManager.getCurrentLoggers())
    log.setLevel(Level.DEBUG)

    Will try that out on monday.

  3. #3
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

    Default

    How does the question relate to spring? You should check documentation of the logging framework you're using

  4. #4
    Join Date
    Feb 2007
    Posts
    13

    Default

    Quote Originally Posted by denis.zhdanov View Post
    How does the question relate to spring? You should check documentation of the logging framework you're using
    Apologies; it's setup through applicationContext.xml in Spring, and can't be autorefreshed using the config setting, as that spawns a thread that never quite dies.

    That said, since it was setup in Spring, I was hoping for some Spring-centric way of doing it. Sorry for the extraneous post!

  5. #5
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

    Default

    Quote Originally Posted by talldean View Post
    Apologies; it's setup through applicationContext.xml in Spring, and can't be autorefreshed using the config setting, as that spawns a thread that never quite dies.

    That said, since it was setup in Spring, I was hoping for some Spring-centric way of doing it. Sorry for the extraneous post!
    Spring still doesn't relate to the question

    Every logging framework I know offers programmatic configuration facility. So, you can just create a bean that is exposed to the client and allows to set given log level to the logger with the given name.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •