[Resin-interest] Unable to access jarfile ./../lib/resin.jar
I got this error when I install resin in my linux redhat machine [r...@web bin]# ./httpd.sh Unable to access jarfile ./../lib/resin.jar Can u suggest a solution. Thnx ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Unable to access jarfile ./../lib/resin.jar
Abdalmonem Tharwat Galila wrote: I got this error when I install resin in my linux redhat machine *[r...@web bin]# ./httpd.sh * *Unable to access jarfile ./../lib/resin.jar* Can u suggest a solution. Does the jar exist? Also, you can start Resin directly with resin-4.0.5 java -jar lib/resin.jar start The *.sh file should essentially just do the same. -- Scott Thnx ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Unable to access jarfile ./../lib/resin.jar
The file doesn't exist. -Original Message- From: resin-interest-boun...@caucho.com [mailto:resin-interest-boun...@caucho.com] On Behalf Of Scott Ferguson Sent: 02 أبريل, 2010 06:44 م To: General Discussion for the Resin application server Subject: Re: [Resin-interest] Unable to access jarfile ./../lib/resin.jar Abdalmonem Tharwat Galila wrote: I got this error when I install resin in my linux redhat machine *[r...@web bin]# ./httpd.sh * *Unable to access jarfile ./../lib/resin.jar* Can u suggest a solution. Does the jar exist? Also, you can start Resin directly with resin-4.0.5 java -jar lib/resin.jar start The *.sh file should essentially just do the same. -- Scott Thnx ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Unable to access jarfile ./../lib/resin.jar
Abdalmonem Tharwat Galila wrote: The file doesn't exist. Then you need to reinstall Resin. If the lib/*.jars don't exist, then Resin isn't installed. -- Scott -Original Message- From: resin-interest-boun...@caucho.com [mailto:resin-interest-boun...@caucho.com] On Behalf Of Scott Ferguson Sent: 02 أبريل, 2010 06:44 م To: General Discussion for the Resin application server Subject: Re: [Resin-interest] Unable to access jarfile ./../lib/resin.jar Abdalmonem Tharwat Galila wrote: I got this error when I install resin in my linux redhat machine *[r...@web bin]# ./httpd.sh * *Unable to access jarfile ./../lib/resin.jar* Can u suggest a solution. Does the jar exist? Also, you can start Resin directly with resin-4.0.5 java -jar lib/resin.jar start The *.sh file should essentially just do the same. -- Scott Thnx ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Sending log4j logs to the web apps log folder
Stargazer wrote: If I have an entry in log4j.properties like this log4j.rootCategory=DEBUG, Console, R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=log/mywebapp.log ... the logs from the webapp appear in $RESIN_HOME/log. Is there an entry I can use to get them to appear in the webapps WEB-INF/log without having to hard code the path please? I'm not as familiar with log4j as I should be. Is there a configuration to send the results to java.util.logging? All of Resin's logging is built around the JDK's logging system. -- Scott ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] jsp:param behavior change from 3.0.22 to 4.0.5
Aaron Freeman wrote: Ok, thanks, we will hold off on pushing forward on upgrading until we get some idea as to whether this is an issue or not. I checked with the spec and the reference implementation: you're not supposed to escape content inside a jsp:param. The container is responsible for any encoding. However, Resin does have a bug in its own encoding for 4.0.5 (fixed for 4.0.6.) So you'll need to wait until at least 4.0.6 for the fix. (4.0.6 is expected next week. It's a short ipv6 release.) -- Scott Aaron On 3/31/2010 2:53 PM, Scott Ferguson wrote: Aaron Freeman wrote: We are experiencing a fundamental change in how data is being passed as a jsp:param between 3.0.22 and 4.0.5. We need to know if this change is intentional as it has a work-heavy impact on converting our code base over which currently relies on the behavior of 3.0.x. It appears that a call to jsp:include was automatically URL decoding any strings that were passed in, and that that behavior has changed. I have included source to two files that will demonstrate the behavior change (in case it's not intentional). And here are the results of running it: I've added a bug report for this at http://bugs.caucho.com/view.php?id=3976. I'll need to check, but there's a good chance this change was made to conform to either the JSP or JSTL spec/TCK. -- Scott on resin-pro-3.0.22 URL encoded before pass to jsp:include: Test%3A+1+%3C+2+and+width%3D%22100%25%22+and+ampersand%3D%26. Test: 1 2 and width=100ïand ampersand= Here it is as seen inside of test-process.jsp: Test: 1 2 and width=100% and ampersand=. on resin-pro-4.0.5 URL encoded before pass to jsp:include: Test%3A+1+%3C+2+and+width%3D%22100%25%22+and+ampersand%3D%26. Test: 1 2 and width=100ïand ampersand= Here it is as seen inside of test-process.jsp: Test:+1++2+and+width=100%+and+ampersand=. %- BEGIN test.jsp -% %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % %@ taglib uri=http://www.sendthisfile.com/taglib/httputil; prefix=httputil % c:if test=${!empty param.textarea} textarea param exists:br/ ${param.textarea}br/br/ c:set var=textareaUrlEncodedBefore value=${httputil:urlEncode(param.textarea)}/ URL encoded before pass to jsp:include:br/ ${textareaUrlEncodedBefore}br/br/ /c:if %-- Set some requestscope variable in test.jsp --% jsp:include page=/test-process.jsp jsp:param name=textarea value=${param.textarea}/ jsp:param name=textareaUrlEncoded value=${textareaUrlEncodedBefore}/ /jsp:include form action=/test.jsp textarea name=textarea${requestScope.processedTextarea}/textarea input type=submit/input /form c:if test=${!empty requestScope.urlEncoded} Here it is as seen inside of test-process.jsp:br/ ${requestScope.urlEncoded} /c:if %- END test.jsp -% %- BEGIN test-process.jsp -% %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % c:choose c:when test=${empty param.textarea} c:set var=processedTextarea scope=requestTest: 1 2 and width=100% and ampersand=./c:set /c:when c:otherwise c:set var=processedTextarea scope=request${param.textarea}/c:set /c:otherwise /c:choose c:set var=urlEncoded scope=request${param.textareaUrlEncoded}/c:set %- END test-process.jsp -% Thanks for your thoughts on this, Aaron ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Sending log4j logs to the web apps log folder
I use this class to do JDK- commons-logging (which could either be modified to go directly to log4j or, just through CL and then to log4j)... import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.LogManager; import java.util.logging.LogRecord; import java.util.logging.Logger; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Writes JDK log messages to commons logging. * * @see http://wiki.apache.org/myfaces/Trinidad_and_Common_Logging; */ public class JavaLoggingToCommonLoggingRedirector { static JDKLogHandler activeHandler; /** * Activates this feature. */ public static void activate() { try { Logger rootLogger = LogManager.getLogManager().getLogger(); // remove old handlers for (Handler handler : rootLogger.getHandlers()) { rootLogger.removeHandler(handler); } // add our own activeHandler = new JDKLogHandler(); activeHandler.setLevel(Level.ALL); rootLogger.addHandler(activeHandler); rootLogger.setLevel(Level.ALL); // done, let's check it right away!!! Logger.getLogger(JavaLoggingToCommonLoggingRedirector.class.getName()).info( activated: sending JDK log messages to Commons Logging); } catch (Exception exc) { LogFactory.getLog(JavaLoggingToCommonLoggingRedirector.class).error(activation failed, exc); } } public static void deactivate() { Logger rootLogger = LogManager.getLogManager().getLogger(); rootLogger.removeHandler(activeHandler); Logger.getLogger(JavaLoggingToCommonLoggingRedirector.class.getName()).info(dactivated); } protected static class JDKLogHandler extends Handler { private MapString, Log cachedLogs = new ConcurrentHashMapString, Log(); private Log getLog(String logName) { Log log = this.cachedLogs.get(logName); if (log == null) { log = LogFactory.getLog(logName); this.cachedLogs.put(logName, log); } return log; } @Override public void publish(LogRecord record) { Log log = this.getLog(record.getLoggerName()); String message = record.getMessage(); Throwable exception = record.getThrown(); Level level = record.getLevel(); if (level == Level.SEVERE) { log.error(message, exception); } else if (level == Level.WARNING) { log.warn(message, exception); } else if (level == Level.INFO) { log.info(message, exception); } else if (level == Level.CONFIG) { log.debug(message, exception); } else { log.trace(message, exception); } } @Override public void flush() { // nothing to do } @Override public void close() { // nothing to do } } } On Fri, Apr 2, 2010 at 12:14 PM, Scott Ferguson f...@caucho.com wrote: Stargazer wrote: If I have an entry in log4j.properties like this log4j.rootCategory=DEBUG, Console, R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=log/mywebapp.log ... the logs from the webapp appear in $RESIN_HOME/log. Is there an entry I can use to get them to appear in the webapps WEB-INF/log without having to hard code the path please? I'm not as familiar with log4j as I should be. Is there a configuration to send the results to java.util.logging? All of Resin's logging is built around the JDK's logging system. -- Scott ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Sending log4j logs to the web apps log folder
Jon Stevens wrote: I use this class to do JDK- commons-logging (which could either be modified to go directly to log4j or, just through CL and then to log4j)... I think he needs the other way around, from log4j to java.util.logging (?) By the way, in Resin 4.0.6 you'll be able to do the same thing with resin xmlns=... system logger name= level= mypkg:JDKLogHandler xmlns=urn:java:org.mycom.mypkg levelall/level /mypkg:JDKLogHandler /logger /system I'm not sure setting the Logger level to all would be a good idea, though, because Logger.isLoggable() would always return true, which would harm performance somewhat. (The system is just to ensure it's configured in the system classloader context, since resin is a child of the system loader. And at some point I need to look into providing an adapter to log4j handlers so you can configure log4j handlers as a java.util.logging handler directly in Resin.) -- Scott import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.LogManager; import java.util.logging.LogRecord; import java.util.logging.Logger; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Writes JDK log messages to commons logging. * * @see http://wiki.apache.org/myfaces/Trinidad_and_Common_Logging; */ public class JavaLoggingToCommonLoggingRedirector { static JDKLogHandler activeHandler; /** * Activates this feature. */ public static void activate() { try { Logger rootLogger = LogManager.getLogManager().getLogger(); // remove old handlers for (Handler handler : rootLogger.getHandlers()) { rootLogger.removeHandler(handler); } // add our own activeHandler = new JDKLogHandler(); activeHandler.setLevel(Level.ALL); rootLogger.addHandler(activeHandler); rootLogger.setLevel(Level.ALL); // done, let's check it right away!!! Logger.getLogger(JavaLoggingToCommonLoggingRedirector.class.getName()).info( activated: sending JDK log messages to Commons Logging); } catch (Exception exc) { LogFactory.getLog(JavaLoggingToCommonLoggingRedirector.class).error(activation failed, exc); } } public static void deactivate() { Logger rootLogger = LogManager.getLogManager().getLogger(); rootLogger.removeHandler(activeHandler); Logger.getLogger(JavaLoggingToCommonLoggingRedirector.class.getName()).info(dactivated); } protected static class JDKLogHandler extends Handler { private MapString, Log cachedLogs = new ConcurrentHashMapString, Log(); private Log getLog(String logName) { Log log = this.cachedLogs.get(logName); if (log == null) { log = LogFactory.getLog(logName); this.cachedLogs.put(logName, log); } return log; } @Override public void publish(LogRecord record) { Log log = this.getLog(record.getLoggerName()); String message = record.getMessage(); Throwable exception = record.getThrown(); Level level = record.getLevel(); if (level == Level.SEVERE) { log.error(message, exception); } else if (level == Level.WARNING) { log.warn(message, exception); } else if (level == Level.INFO) { log.info http://log.info(message, exception); } else if (level == Level.CONFIG) { log.debug(message, exception); } else { log.trace(message, exception); } } @Override public void flush() { // nothing to do } @Override public void close() { // nothing to do } } } On Fri, Apr 2, 2010 at 12:14 PM, Scott Ferguson f...@caucho.com mailto:f...@caucho.com wrote: Stargazer wrote: If I have an entry in log4j.properties like this log4j.rootCategory=DEBUG, Console, R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=log/mywebapp.log ... the logs from the webapp appear in $RESIN_HOME/log. Is there an entry I can use to get them to appear in the webapps WEB-INF/log without having to hard code the path please? I'm not as familiar with log4j as I should be. Is there a configuration to send the results to java.util.logging? All of Resin's logging is built around the JDK's logging system. -- Scott ___ resin-interest mailing list resin-interest@caucho.com mailto:resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com mailto:resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___
[Resin-interest] FW: Starting resin: failed!
I get this message marked with RED when I run resin , but when I run the following command I get this error marked with BLUE ( [r...@web ~]# service resin restart Stopping resin: failed! Starting resin: failed! [r...@web ~]# ) Apr 2, 2010 9:50:12 PM com.caucho.boot.WatchdogProcess run INFO: WatchdogProcess[Watchdog[],1] starting Resin [21:50:13.611] {watchdog-} WatchdogProcess[Watchdog[],1] starting Resin Resin-3.1.10 (built Tue, 23 Feb 2010 02:57:09 PST) Copyright(c) 1998-2008 Caucho Technology. All rights reserved. Using Resin(R) Open Source under the GNU Public License (GPL). See http://www.caucho.com for information on Resin Professional, including caching, clustering, JNI acceleration, and OpenSSL integration. Starting Resin on Fri, 02 Apr 2010 21:50:28 +0200 (EET) [21:50:32.697] {main} 'select-manager' requires Resin Professional. See http://www.caucho.com for information and licensing. [21:50:32.698] {main} [21:50:32.698] {main} Linux 2.6.18-128.el5 amd64 [21:50:32.698] {main} Java(TM) SE Runtime Environment 1.6.0_19-b04, UTF-8, en [21:50:32.698] {main} Java HotSpot(TM) 64-Bit Server VM 16.2-b04, 64, mixed mode, Sun Microsystems Inc. [21:50:32.698] {main} user.name: root [21:50:32.699] {main} resin.home = /usr/local/Resin/ [21:50:32.700] {main} resin.root = /usr/local/Resin/ [21:50:32.700] {main} resin.conf = /usr/local/Resin/conf/resin.conf [21:50:32.700] {main} [21:50:33.257] {main} WebApp[http://localhost:8080] active [21:50:33.519] {main} WebApp[http://localhost:8080/resin-admin] active [21:50:34.481] {main} WebApp[http://localhost:8080/resin-doc] active [21:50:34.481] {main} Host[] active [21:50:34.497] {main} hmux listening to web.dotmasr.eg:6800 [21:50:34.506] {main} http listening to *:8080 [21:50:34.515] {main} Server[id=,cluster=app-tier] active [21:50:34.592] {main} Resin started in 6352ms [21:50:36.043] {http--8080-1$617013740} Loading .tld files from global classpath ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Sending log4j logs to the web apps log folder
Consider this another vote for a possible switch to using SLF4j as the Resin logging interface. It's a very thin API that is an extremely powerful aggregator of log information. (*Chris*) On Fri, Apr 2, 2010 at 12:57 PM, Jeff Schnitzer j...@infohazard.org wrote: I'm pretty sure that it's possible to configure any possible combination of input loggers and output destinations by mixing and matching the various components of SLF4J. To get log4j output to java.util.logging, you could use the log4j-slf4j bridge, then use the slf4j output module that dumps to java.util.logging. There's no configuration, you just pick which jar files you include in your project. In this case it would be: slf4j-X.X.X.jar (the base jar) log4j-over-slf4j-X.X.X.jar (the bridge) slf4j-jdk14-X.X.X.jar (the output module) Just add these jars to your project (leave out the log4j jar) and I'm pretty sure that you'll find all log4j output sent to the resin logger. Jeff On Fri, Apr 2, 2010 at 12:43 PM, Scott Ferguson f...@caucho.com wrote: Jon Stevens wrote: I use this class to do JDK- commons-logging (which could either be modified to go directly to log4j or, just through CL and then to log4j)... I think he needs the other way around, from log4j to java.util.logging (?) By the way, in Resin 4.0.6 you'll be able to do the same thing with resin xmlns=... system logger name= level= mypkg:JDKLogHandler xmlns=urn:java:org.mycom.mypkg levelall/level /mypkg:JDKLogHandler /logger /system I'm not sure setting the Logger level to all would be a good idea, though, because Logger.isLoggable() would always return true, which would harm performance somewhat. (The system is just to ensure it's configured in the system classloader context, since resin is a child of the system loader. And at some point I need to look into providing an adapter to log4j handlers so you can configure log4j handlers as a java.util.logging handler directly in Resin.) -- Scott import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.LogManager; import java.util.logging.LogRecord; import java.util.logging.Logger; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Writes JDK log messages to commons logging. * * @see http://wiki.apache.org/myfaces/Trinidad_and_Common_Logging; */ public class JavaLoggingToCommonLoggingRedirector { static JDKLogHandler activeHandler; /** * Activates this feature. */ public static void activate() { try { Logger rootLogger = LogManager.getLogManager().getLogger(); // remove old handlers for (Handler handler : rootLogger.getHandlers()) { rootLogger.removeHandler(handler); } // add our own activeHandler = new JDKLogHandler(); activeHandler.setLevel(Level.ALL); rootLogger.addHandler(activeHandler); rootLogger.setLevel(Level.ALL); // done, let's check it right away!!! Logger.getLogger(JavaLoggingToCommonLoggingRedirector.class.getName()).info( activated: sending JDK log messages to Commons Logging); } catch (Exception exc) { LogFactory.getLog(JavaLoggingToCommonLoggingRedirector.class).error(activation failed, exc); } } public static void deactivate() { Logger rootLogger = LogManager.getLogManager().getLogger(); rootLogger.removeHandler(activeHandler); Logger.getLogger(JavaLoggingToCommonLoggingRedirector.class.getName()).info(dactivated); } protected static class JDKLogHandler extends Handler { private MapString, Log cachedLogs = new ConcurrentHashMapString, Log(); private Log getLog(String logName) { Log log = this.cachedLogs.get(logName); if (log == null) { log = LogFactory.getLog(logName); this.cachedLogs.put(logName, log); } return log; } @Override public void publish(LogRecord record) { Log log = this.getLog(record.getLoggerName()); String message = record.getMessage(); Throwable exception = record.getThrown(); Level level = record.getLevel(); if (level == Level.SEVERE) { log.error(message, exception); } else if (level == Level.WARNING) { log.warn(message, exception); } else if (level == Level.INFO) { log.info http://log.info(message, exception); } else if (level == Level.CONFIG) { log.debug(message, exception); } else { log.trace(message, exception); } } @Override public void flush() { // nothing to do } @Override public void close() { // nothing to do } } } On Fri, Apr 2, 2010 at 12:14 PM, Scott Ferguson f...@caucho.com mailto:f...@caucho.com wrote: Stargazer wrote: If I have an entry in log4j.properties like this log4j.rootCategory=DEBUG, Console, R log4j.appender.R=org.apache.log4j.RollingFileAppender
Re: [Resin-interest] Starting resin: failed!
Problem Solved , the pass of RESIN_HOME is incorrect. From: Abdalmonem Tharwat Galila Sent: 02 أبريل, 2010 10:03 م To: 'resin-interest@caucho.com' Cc: Mohamed SALAH MOSELHI Subject: FW: Starting resin: failed! I get this message marked with RED when I run resin , but when I run the following command I get this error marked with BLUE ( [r...@web ~]# service resin restart Stopping resin: failed! Starting resin: failed! [r...@web ~]# ) Apr 2, 2010 9:50:12 PM com.caucho.boot.WatchdogProcess run INFO: WatchdogProcess[Watchdog[],1] starting Resin [21:50:13.611] {watchdog-} WatchdogProcess[Watchdog[],1] starting Resin Resin-3.1.10 (built Tue, 23 Feb 2010 02:57:09 PST) Copyright(c) 1998-2008 Caucho Technology. All rights reserved. Using Resin(R) Open Source under the GNU Public License (GPL). See http://www.caucho.com for information on Resin Professional, including caching, clustering, JNI acceleration, and OpenSSL integration. Starting Resin on Fri, 02 Apr 2010 21:50:28 +0200 (EET) [21:50:32.697] {main} 'select-manager' requires Resin Professional. See http://www.caucho.com for information and licensing. [21:50:32.698] {main} [21:50:32.698] {main} Linux 2.6.18-128.el5 amd64 [21:50:32.698] {main} Java(TM) SE Runtime Environment 1.6.0_19-b04, UTF-8, en [21:50:32.698] {main} Java HotSpot(TM) 64-Bit Server VM 16.2-b04, 64, mixed mode, Sun Microsystems Inc. [21:50:32.698] {main} user.name: root [21:50:32.699] {main} resin.home = /usr/local/Resin/ [21:50:32.700] {main} resin.root = /usr/local/Resin/ [21:50:32.700] {main} resin.conf = /usr/local/Resin/conf/resin.conf [21:50:32.700] {main} [21:50:33.257] {main} WebApp[http://localhost:8080] active [21:50:33.519] {main} WebApp[http://localhost:8080/resin-admin] active [21:50:34.481] {main} WebApp[http://localhost:8080/resin-doc] active [21:50:34.481] {main} Host[] active [21:50:34.497] {main} hmux listening to web.dotmasr.eg:6800 [21:50:34.506] {main} http listening to *:8080 [21:50:34.515] {main} Server[id=,cluster=app-tier] active [21:50:34.592] {main} Resin started in 6352ms [21:50:36.043] {http--8080-1$617013740} Loading .tld files from global classpath ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Sending log4j logs to the web apps log folder
Why would you want Resin to log through slf4j? I actually think this would make a really big mess out of our apps, because now the slf4j jars would be provided for us and potentially cause conflicts. Resin provides a concrete logging system (in this case, j.u.l). We write our code using slf4j and by using the slf4j-jdk14.jar adapter, everything just works. This seems pretty straightforward. I'd hate to have to configure the slf4j logging in the container. Jeff On Fri, Apr 2, 2010 at 1:13 PM, Chris Pratt thechrispr...@gmail.com wrote: Consider this another vote for a possible switch to using SLF4j as the Resin logging interface. It's a very thin API that is an extremely powerful aggregator of log information. (*Chris*) On Fri, Apr 2, 2010 at 12:57 PM, Jeff Schnitzer j...@infohazard.org wrote: I'm pretty sure that it's possible to configure any possible combination of input loggers and output destinations by mixing and matching the various components of SLF4J. To get log4j output to java.util.logging, you could use the log4j-slf4j bridge, then use the slf4j output module that dumps to java.util.logging. There's no configuration, you just pick which jar files you include in your project. In this case it would be: slf4j-X.X.X.jar (the base jar) log4j-over-slf4j-X.X.X.jar (the bridge) slf4j-jdk14-X.X.X.jar (the output module) Just add these jars to your project (leave out the log4j jar) and I'm pretty sure that you'll find all log4j output sent to the resin logger. Jeff On Fri, Apr 2, 2010 at 12:43 PM, Scott Ferguson f...@caucho.com wrote: Jon Stevens wrote: I use this class to do JDK- commons-logging (which could either be modified to go directly to log4j or, just through CL and then to log4j)... I think he needs the other way around, from log4j to java.util.logging (?) By the way, in Resin 4.0.6 you'll be able to do the same thing with resin xmlns=... system logger name= level= mypkg:JDKLogHandler xmlns=urn:java:org.mycom.mypkg levelall/level /mypkg:JDKLogHandler /logger /system I'm not sure setting the Logger level to all would be a good idea, though, because Logger.isLoggable() would always return true, which would harm performance somewhat. (The system is just to ensure it's configured in the system classloader context, since resin is a child of the system loader. And at some point I need to look into providing an adapter to log4j handlers so you can configure log4j handlers as a java.util.logging handler directly in Resin.) -- Scott import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.LogManager; import java.util.logging.LogRecord; import java.util.logging.Logger; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Writes JDK log messages to commons logging. * * @see http://wiki.apache.org/myfaces/Trinidad_and_Common_Logging; */ public class JavaLoggingToCommonLoggingRedirector { static JDKLogHandler activeHandler; /** * Activates this feature. */ public static void activate() { try { Logger rootLogger = LogManager.getLogManager().getLogger(); // remove old handlers for (Handler handler : rootLogger.getHandlers()) { rootLogger.removeHandler(handler); } // add our own activeHandler = new JDKLogHandler(); activeHandler.setLevel(Level.ALL); rootLogger.addHandler(activeHandler); rootLogger.setLevel(Level.ALL); // done, let's check it right away!!! Logger.getLogger(JavaLoggingToCommonLoggingRedirector.class.getName()).info( activated: sending JDK log messages to Commons Logging); } catch (Exception exc) { LogFactory.getLog(JavaLoggingToCommonLoggingRedirector.class).error(activation failed, exc); } } public static void deactivate() { Logger rootLogger = LogManager.getLogManager().getLogger(); rootLogger.removeHandler(activeHandler); Logger.getLogger(JavaLoggingToCommonLoggingRedirector.class.getName()).info(dactivated); } protected static class JDKLogHandler extends Handler { private MapString, Log cachedLogs = new ConcurrentHashMapString, Log(); private Log getLog(String logName) { Log log = this.cachedLogs.get(logName); if (log == null) { log = LogFactory.getLog(logName); this.cachedLogs.put(logName, log); } return log; } @Override public void publish(LogRecord record) { Log log = this.getLog(record.getLoggerName()); String message = record.getMessage(); Throwable exception = record.getThrown(); Level level = record.getLevel(); if (level == Level.SEVERE) { log.error(message, exception); } else if (level == Level.WARNING) { log.warn(message, exception); } else if (level == Level.INFO) { log.info http://log.info(message, exception); } else if (level ==