# Trying to skip a console appender- want all errors trapped by ZK to log to my log4j file appender?

rickcr
704 7

I'm sure this is simple simple I'm missing. I don't want any errors dumping to my catalina.out file under Tomcat. Any errors thrown, runtime or otherwise, I want dumping to my rolling file appender. I removed my console out appender and set my root logger to my file appender but I can't seem to get errors thrown to it.

Obviously ZK is trapping errors since for example if I do a divide by zero error I'll see a zk popup window with the error displayed. I want the actual error though to show up in my file appender.

Here is what I've tried so far:

log4j.rootLogger=debug, app-appender

log4j.logger.org.springframework=info, app-appender
log4j.logger.com.ncs=debug, app-appender
log4j.logger.org.ibatis=info, app-appender
log4j.logger.org.zkoss=debug, app-appender

log4j.appender.app-appender=org.apache.log4j.RollingFileAppender
log4j.appender.app-appender.threshold=ALL
log4j.appender.app-appender.File=\${catalina.home}/logs/productReference.log
log4j.appender.app-appender.MaxFileSize=2000KB
log4j.appender.app-appender.MaxBackupIndex=5
log4j.appender.app-appender.Append=false
log4j.appender.app-appender.layout=org.apache.log4j.PatternLayout
log4j.appender.app-appender.layout.ConversionPattern= %d{MM/dd/yy hh:mm:ss a } %-5p %C %M - %m%n


Not sure if all this is needed as well but I also added:

web.xml

<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j.properties</param-value>
</context-param>


zk.xml

<log>
<log-base>org.zkoss</log-base>
</log>
<library-property>
<name>org.zkoss.util.logging.config.file</name>
<value>/log4j.properties</value>
</library-property>


delete retag edit

## 2 Replies

rickcr
704 7

I haven't dug into the source code but is it possible that after ZK traps a runtime exception that it's not attempting to log it with java.util.logging? I understand how if it were simply rethrowing the error I'd have issues getting it logged to my appender, but it's obviously trapping it first since it's showing a zk popup, so I'd assume it attempts to log the exception as well?

paowang
140 6

As I know, ZK uses the java standard logger (i.e java.util.loggin). You can't give ZK a log4j configuration.
Check this: http://books.zkoss.org/wiki/ZK_Developer%27s_Reference/Supporting_Utilities/Logger#Disable_All_Logs

[hide preview]