Re: log4j in two different project
Hi Is there any help I can get in this? * Are you log4j.properties files for each project identical? o No * the config file for you webapp doesn't provide the configuration you require for your DAO o How to do this? What does this mean? * is the DAO project deployed in WEB-INF/lib o What does this mean? how I can check? Thanks, Anjib On 1/9/2012 4:37 PM, Jacob Kjome wrote: Are you log4j.properties files for each project identical? My guess is that they are different and the config file for you webapp doesn't provide the configuration you require for your DAO. BTW, is the DAO project deployed in WEB-INF/lib? That is, is it part of the same classloader as the webapp. That could be an issue as well if it is not. Jake On Mon, 9 Jan 2012 12:24:19 -0500 Anjib Mulepati anji...@hotmail.com wrote: I have two different projects a) One for my DAO and b) Another for my web application. Web application uses the DAO jar file to handle all DAO operations. In both project I have configured the log4j.properties (lo4j-1.2.14) file and using commons-logging 1.1.1. When I run test code independently in DAO project I can see the log but when I try to see the log for DAO by running my application DAO logs are not generated I can only see the logs from my web application. What I am doing wrong? - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: log4j in two different project
On Thu, 12 Jan 2012 10:13:20 -0500 Anjib Mulepati anji...@hotmail.com wrote: Hi Is there any help I can get in this? * Are you log4j.properties files for each project identical? o No * the config file for you webapp doesn't provide the configuration you require for your DAO o How to do this? What does this mean? Because your DAO project (jar file) runs within the context of your webaapp and Log4j provides only a single configuration context per webapp (assuming Log4j.jar is deployed in WEB-INF/lib and you are using child-first classloading), then you need your config file to encompass the configuration for all applicable libraries. In this sense, you shouldn't think of your DAO project as something separate from the webapp. It's really a library dependency of the webapp, making it, for all intents and purposes, part of a single application. * is the DAO project deployed in WEB-INF/lib o What does this mean? how I can check? I presume your DAO project is represented as a jar file, no? If you use it as part of your webapp, then it must a library dependency of the webapp. If it is a library dependency of your webapp, then you normally deploy this in WEB-INF/lib. I'll leave it at that. Jake Thanks, Anjib On 1/9/2012 4:37 PM, Jacob Kjome wrote: Are you log4j.properties files for each project identical? My guess is that they are different and the config file for you webapp doesn't provide the configuration you require for your DAO. BTW, is the DAO project deployed in WEB-INF/lib? That is, is it part of the same classloader as the webapp. That could be an issue as well if it is not. Jake On Mon, 9 Jan 2012 12:24:19 -0500 Anjib Mulepati anji...@hotmail.com wrote: I have two different projects a) One for my DAO and b) Another for my web application. Web application uses the DAO jar file to handle all DAO operations. In both project I have configured the log4j.properties (lo4j-1.2.14) file and using commons-logging 1.1.1. When I run test code independently in DAO project I can see the log but when I try to see the log for DAO by running my application DAO logs are not generated I can only see the logs from my web application. What I am doing wrong? - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Log4j and Java7/JDBC4.1's CommonDataSource.getParentLogger()
I have hit the same situation with software that requires use of Apahce commons logging, I use slf4j (and have it feed log4j); it has adapters to let you log from j.u.l and commons logging. I don't know if it's best practice, but it certainly works. ■ DOUGLAS E. WEGSCHEID // LEAD ENGINEER (269) 923-5278 // douglas_e_wegsch...@whirlpool.com A wrong note played hesitatingly is a wrong note. A wrong note played with conviction is interpretation. BRUNO MELLONI bruno.mell...@chickasaw.net 01/11/2012 05:56 PM Please respond to Log4J Users List log4j-user@logging.apache.org To log4j-user@logging.apache.org log4j-user@logging.apache.org cc Subject Log4j and Java7/JDBC4.1's CommonDataSource.getParentLogger() Just upgraded from Java 6 to Java 7 and got a nasty surprise. I have a class that extends from JDBC's AbstractDataSource. Java 7/JDBC4.1 requires implementing the abstract method getParentLogger() from CommonDataSource. The method returns a java.util.logging.Logger, but I use log4j. I imagine that this problem has been encountered before and solved. What is the best practice solution?
RE: Log4j and Java7/JDBC4.1's CommonDataSource.getParentLogger()
I am not following. I already have slf4j in my stack (needed by other libraries), although I've written no code that directly interacts with it. I assume that you are telling me to implement getParentLogger() in my datasource (so that it compiles in Java7) and that I should put a couple lines of code based on slf4j to get that parent logger so that it really is reflecting the log4j logger. The obvious dumb question is... what would that code look like? -Original Message- From: Douglas E Wegscheid [mailto:douglas_e_wegsch...@whirlpool.com] Sent: Thursday, January 12, 2012 6:51 AM To: Log4J Users List Cc: log4j-user@logging.apache.org Subject: Re: Log4j and Java7/JDBC4.1's CommonDataSource.getParentLogger() I have hit the same situation with software that requires use of Apahce commons logging, I use slf4j (and have it feed log4j); it has adapters to let you log from j.u.l and commons logging. I don't know if it's best practice, but it certainly works. ■ DOUGLAS E. WEGSCHEID // LEAD ENGINEER (269) 923-5278 // douglas_e_wegsch...@whirlpool.com A wrong note played hesitatingly is a wrong note. A wrong note played with conviction is interpretation. BRUNO MELLONI bruno.mell...@chickasaw.net 01/11/2012 05:56 PM Please respond to Log4J Users List log4j-user@logging.apache.org To log4j-user@logging.apache.org log4j-user@logging.apache.org cc Subject Log4j and Java7/JDBC4.1's CommonDataSource.getParentLogger() Just upgraded from Java 6 to Java 7 and got a nasty surprise. I have a class that extends from JDBC's AbstractDataSource. Java 7/JDBC4.1 requires implementing the abstract method getParentLogger() from CommonDataSource. The method returns a java.util.logging.Logger, but I use log4j. I imagine that this problem has been encountered before and solved. What is the best practice solution? - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
RE: Log4j and Java7/JDBC4.1's CommonDataSource.getParentLogger()
see http://www.slf4j.org/legacy.html you are looking for SLF4J bound to log4j with redirection of commons-logging and jul calls to SLF4J. See the section on jul-to-slf4j bridge, and the reference to SLF4JBridgeHandler javadocs. I would ask on one of the SLF4J groups for more details, if needed. ■ DOUGLAS E. WEGSCHEID // LEAD ENGINEER (269) 923-5278 // douglas_e_wegsch...@whirlpool.com A wrong note played hesitatingly is a wrong note. A wrong note played with conviction is interpretation. BRUNO MELLONI bruno.mell...@chickasaw.net wrote on 01/12/2012 11:19:57 AM: I am not following. I already have slf4j in my stack (needed by other libraries), although I've written no code that directly interacts with it. I assume that you are telling me to implement getParentLogger() in my datasource (so that it compiles in Java7) and that I should put a couple lines of code based on slf4j to get that parent logger so that it really is reflecting the log4j logger. The obvious dumb question is... what would that code look like? -Original Message- From: Douglas E Wegscheid [mailto:douglas_e_wegsch...@whirlpool.com] Sent: Thursday, January 12, 2012 6:51 AM To: Log4J Users List Cc: log4j-user@logging.apache.org Subject: Re: Log4j and Java7/JDBC4.1's CommonDataSource.getParentLogger() I have hit the same situation with software that requires use of Apahce commons logging, I use slf4j (and have it feed log4j); it has adapters to let you log from j.u.l and commons logging. I don't know if it's best practice, but it certainly works. ■ DOUGLAS E. WEGSCHEID // LEAD ENGINEER (269) 923-5278 // douglas_e_wegsch...@whirlpool.com A wrong note played hesitatingly is a wrong note. A wrong note played with conviction is interpretation. BRUNO MELLONI bruno.mell...@chickasaw.net 01/11/2012 05:56 PM Please respond to Log4J Users List log4j-user@logging.apache.org To log4j-user@logging.apache.org log4j-user@logging.apache.org cc Subject Log4j and Java7/JDBC4.1's CommonDataSource.getParentLogger() Just upgraded from Java 6 to Java 7 and got a nasty surprise. I have a class that extends from JDBC's AbstractDataSource. Java 7/JDBC4.1 requires implementing the abstract method getParentLogger() from CommonDataSource. The method returns a java.util.logging.Logger, but I use log4j. I imagine that this problem has been encountered before and solved. What is the best practice solution? - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org