• 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

Log4J issues

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Sorry if this is a wrong forum to post the Log 4J issue. I couldn't find a appropriate one. Hence am posting here.

My question is

My log4j.properties is like this:-



and in the java file, I am first instantiating the logger like this:-

static Logger logger = Logger.getLogger("com.test.emp");

and when I use logger.debug statement the statements are printing multiple times.

i.e when the same statement is first invoked it is printing one time. the next time, it is printing two times and so on.

I googled out and find to see that if I include

log4j.additivity.rootLogger=false in log4j.properties, then it will fix this issue.

But to my surprise it is not printing at all now.

Can someone please help?
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Log4j with xml configuration under weblogic 9.2

I put new log4j.xml in my application(is running under Weblogic 9.2), but my server weblogic does not read my log4j.xml. When I checked in the setDomainEnv.cmd file from bin, I found my JAVA CLASSPATH that point
to some other log file, called apache....xml from WLI, it is something like this: -Dlog4j.configuration=%...%/apache ....xml

I tried to duplicate this command by adding the following row: -Dlog4j.configuration=.%....%/log4j.xml.
But this does not work correctly, in fact the second line will override the first one, so the Weblogic will take into consideration only the second line, whether the first setting is still needed for the Weblogic Integration, so it should not be overridden.

The question is how should I configure in the classpath the log4j for my application, and still keeping the configuration that already exists?
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Marcu,

Can you please post your question in a separate thread. We'll try to tackle each problem separately
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by satheesh krishnaswamy:
Hi,

Sorry if this is a wrong forum to post the Log 4J issue. I couldn't find a appropriate one. Hence am posting here.

My question is

My log4j.properties is like this:-


and in the java file, I am first instantiating the logger like this:-

static Logger logger = Logger.getLogger("com.test.emp");

and when I use logger.debug statement the statements are printing multiple times.

i.e when the same statement is first invoked it is printing one time. the next time, it is printing two times and so on.

I googled out and find to see that if I include

log4j.additivity.rootLogger=false in log4j.properties, then it will fix this issue.

But to my surprise it is not printing at all now.

Can someone please help?



Hi Satheesh,

This is the right forum

I think this article might help explain what is going on. By setting the additivity to false at the root level you're basically telling it not to log at all, you need to set the additivity at the package level you want to stop at, the article explains further.

Hope that helps!
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you upload complete java code i think you are using .. something like this




some where in your class hierarchy
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic