This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Log4J issues

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • 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
  • 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: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Willie Smits can speak 40 languages. This tiny ad can speak only one:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!