• 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

problem read log4j configurations from tomcat

 
Ranch Hand
Posts: 620
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all

im using log4j for my application , my log4j getting its properties as Properties object

like this :

PropertyConfigurator.configure(prop);

but when i load the application into tomcat all the logging information is writen into console , even so i configured allso to write to file

here is my log4j configuration :


now the strange thing is when i run it from within eclipse or i make separate log4j configuration file and put it into

classes dir of my application every thing is working fine

why is that ?
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure you are picking up the right properties file through your code? Can you post the code where you are reading the log4j.properties and converting it to a properties object.
 
ben josh
Ranch Hand
Posts: 620
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi and thanks for the reply
well acutely i don't read it from log4j.properties file but i have 1 conf file and this conf file has this section i posted in it
i read only the relevant section ( every key that starts with "log4j." ) and then converted to Properties object and then using
the code the is reading from the conf file is very long because it part of large modules

PropertyConfigurator.configure(prop);

now its working fine under eclipse it has problems when i run the application outside of eclipse

i have another question if i may ask how can i check in log4j
if its already have its configuration properties set ?

to set the logger properties file
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic