log4j

Is it possible to change the log level of a package in log4j?

Currently I have a library that is logging certain information as ERROR. If I change my log4j settings like this: log4j.logger.com.company.theirpackage.foo=OFF that will completely disable the library's logging altogether. However, what I'd really like is to still see the information, but have it logged at a WARN or INFO level. In oth...

Is Log4j being abandoned in favor of Slf4j?

It seems that log4j has some class loading issues (among others) and it seems to me the trend is to move out of log4j toward slf4j. (Hibernate stopped using the first in favor of the latter) Is it true? What are the main issues in log4j that slf4j solves? Is slf4j the final word or is there even a better "the next next log4j" industry ...

Log4j DailyRollingFileAppender concurrency with multiple processes

I have a number of identical processes that are writing to a single log file using a Log4j DailyRollingFileAppender. I am concerned that multiple processes may try and roll the file and that chaos will ensue. Does the implementation allow for this using with some kind of locking mechanism? - the Javadoc doesn't mention it. ...

Java: How to log any time something put in session?

I am evaluating a JSF Java project with 100 or so screens and would like to be able to log every time something is put in to the HTTP session along with who's calling the method on the session object and what the paramters are, to make it easier for me to know what's going into session when I click through the site. So I want a log lik...

Making log4j aware of changes in the configuration at runtime

I wonder if there is a non-programatical way of making log4j aware of changes on the configuration at runtime. I know I can use static { PropertyConfigurator.configureAndWatch("log4j.properties", 100); } at some useful place to watch a property file for changes, but I would prefer an option within the property file itself, to tell ...

how to run EJB 3 app on Jboss application server

While running the application i do not able to set the jndi.properties and log4j.properties Actually i have to se the following properities but I do not know where to write these code in a file or somewhere else. If in file what will be the file extension and file name and where to keep it in application. jndi.properties: java.naming....

Using the Log4J JMSAppender with ActiveMQ

I am trying to produce a proof of concept shipping logging from Log4J through JMS using the log4J JMSAppender. I have tried ActiveMQ and the example supplied with it. I have torn this example apart, and made it more generic and compatible with multiple platforms. It looks like I have it all plumbed up OK as I can see a connection to the...

Unable to initalize log4j

Hi, I am trying to initialize log4j-1.2.8 for my application by creating a listener class implemented from the ApplicationLifecycleListener of Weblogic 9.2 When I deploy the application, I am getting following exceptions: java.lang.NoClassDefFoundError: org/apache/log4j/spi/RepositorySelector at java.lang.ClassLoader.defineClass1(Nati...

Initialization error with Log4j 1.2.12 and Jetty 6.1.21

I'm trying to setup a simple Jetty ServletTester with a servlet from a colleague. But now the initialization of the log4j Logger fails, giving me a bunch of exceptions. Do I need to setup permissions on the ServletTester startup? This is the line in my servlet: private static final Logger LOG = Logger.getLogger( MyServlet.class ); ...

Why does log4j default to outputting the "No appenders could be found" message rather than outputting to stdout?

I have long wondered why log4j defaults to outputting an error message when there is no log4j.properties. A reasonable default to stdout or stderr would make more sense. Is there a FAQ or a discussion about this somewhere that indicates the reasoning behind this decision? I have always considered that to be the only thing about log4j tha...

How to change Weblogic 10/11's log format?

I want to change the log format for Weblogic's server log. Right now it's generating logs using its default format-- I want to be able to specify my own format. For example, it generates logs that look like this: ####<Jan 21, 2010 3:24:24 PM EST> <Info> <Socket> <FS2LOANER-00981> <DPSCoreServer1> <[STANDBY] ExecuteThread: '1' for queu...

Baffled by Java Logging Systems with Spring and Hibernate

Hi Everyone WHen deploying my Spring / Hibernate application, I get the following warning related to logging: log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. Surprising to me was the lack of information from a Google / SO search...

Is it possible to reload log4j.xml / log4j.properties file dynamically in Tomcat?

The problem is, whenever you change the log4j.properties/log4j.xml, you need to restart the tomcat [ or say any other server ]. Is there any workaround of reloading the log4j configuration? ...

Log4j Maximum String Length OR Java String Concatenation Error?

Running on Solaris 10, I am having problems when I hit a LOG.debug statement using an Apache Log4j logger. The basic scenario is demonstrated in the following code block: public class MyClass { private static final Logger LOG = Logger.getLogger(MyClass.class.getName()); private LinkedHashMap<String, String> myMap = new ...

How to disable the debug logging of class using log4j?

In my log4j.xml, i am having <logger name="java.sql"> <level value="DEBUG" /> </logger> But using this, it also enables the logging for the interface Resultset. If i want to disable the logging for this interface but still want to have the debug logging for statement, preparedstatement, etc... How can i do this? ...

log4j sample configuration file (properties file)

What is the easiest way to get started with log4j configuration? ...

How to set log4j with unlimited max file size?

I didn't get a definitive answer to this question by Google'ing, so I pose it to the groupthink masterminds and to ensure that a quality answer can be Google-able in the future. Using log4j RollingFileAppender, I can set the maximum size I want the file to reach before rolling over on itself, like so: RollingFileAppender rfa = new Roll...

logging specific package's messages to one file in grails and log4j

trying to get all of the log statements from class GetThatDataFilters to go to the rolling file 'dailydata' and everything else to the console and the daily rolling file. dont know if I am missing something from the grails documentation http://www.grails.org/doc/latest/guide/3.%20Configuration.html#3.1.2%20Logging // ==================...

Working log4j config ignored by Spring classes

Hi, I use log4j and he work just fine. A log4j.xml file is in my classpath, i use appender and category... again, it's work just fine for my code or code of other librairy. But the spring classes continue to flood stdout with message i want to log elsewhere. It's beggin to be anoying. Offending message : org.springframework.jms : som...

Are log4j.properties file includes supported?

Does log4j support properties files includes - like commons configuration - so I could include one file from another, overriding properties as appropriate? I have tried doing it, and it doesn't seem to work. Is there an alternate way to achieve the same reuse? ...