• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Own logfile for every application

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I want to use java logging for my jsp applications. I managed to configure java logging by an logging.propeerties file that I placed in the application's root directory.
Then I deploy the application into Tomcat and everything works fine. The application produces a log file with its name and logs into it.
When I deploy a second application with a different logging.properties file into Tomcat it overwrites the configuration of the first application. Both applications now log into the file of the second application.

I tried to subclass java.util.logging.LogManager and to call the (protected) constructor. But it doesn't help.

Has anyone expreience with java logging and different applications with different logging configuration? Please help me! andreas.knees@gmx.de

Ciao

Andi
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I bet you are using the same Logger instance for both applications. You need to create independent Logger instances and configure them to write to seperate files. The name you pass to Logger.getLogger() determines if you get an existing Logger:


Loggers are normally named, using a hierarchical dot-separated namespace. Logger names can be arbitrary strings, but they should normally be based on the package name or class name of the logged component, such as java.net or javax.swing. In additon it is possible to create "anonymous" Loggers that are not stored in the Logger namespace.


java.util.logging.Logger
Read through the docs for this and the other classes in java.util.logging. Things will make a lot more sense if you do.
 
Water! People swim in water! Even tiny ads swim in water:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic