0

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

asked 2012-11-12 16:28:11 +0800

rickcr gravatar image 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 flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2012-11-12 16:50:50 +0800

rickcr gravatar image 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?

link publish delete flag offensive edit

answered 2012-11-13 01:57:53 +0800

paowang gravatar image 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

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-11-12 16:28:11 +0800

Seen: 52 times

Last updated: Nov 13 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More