开发者

Logging to certain file utilizing log4j (problem with HQ)

开发者 https://www.devze.com 2023-03-08 02:49 出处:网络
EDIT: So it appears that the problem is in the log level of my log handlers/appenders and root logger. Somehow HQ (simply the other app) has it\'s logs configured to get all log messages. What I need

EDIT: So it appears that the problem is in the log level of my log handlers/appenders and root logger. Somehow HQ (simply the other app) has it's logs configured to get all log messages. What I need is to prohibit my jsa handler to pass log messages up the level.

Hi. I have an issue with my logging.

Info: I've got several apps (including hyperic, further HQ) running on a server. And there's also a groovy app/script running on the server. HQ triggers a script but actually has no integration with it, meaning that all HQ knows about gr开发者_StackOverflow社区oovy script is the output in command line produced by groovy script.

Problem: somehow HQ logs get all the messages from groovy script. I may assume that when groovy does it's logging it also prints all the logs to standard java log which is in turn overridden by HQ.

I have a log4j configuration for groovy script which should have made logging to default java log impossible.

log4j.rootLogger=info, jsa
log4j.logger.net.schmizz.sshj=WARN

#Defining logger scope and it's params
log4j.logger.mypackage=INFO, jsa
log4j.appender.jsa=org.apache.log4j.RollingFileAppender
log4j.appender.jsa.File=logs/jsa.log
log4j.appender.jsa.MaxFileSize=1MB
log4j.appender.jsa.MaxBackupIndex=5
log4j.appender.jsa.layout=org.apache.log4j.PatternLayout
log4j.appender.jsa.layout.ConversionPattern=%d [%t] %-5p %c (%F:%L) - %m%n

Though I still get all the nasty logging.

P.S.: I also use slf4j for flexibility, though I doubt it cold have done this trick.


The problem is not in logging (though additivity options will be useful here) but in the directory where the groovy files reside. In HQ version 4.3 all the files in hq-plugins are saved to tmp directory and the changed files are also saved there (so if you have a file foo.txt and you put it there, it will be saved in tmp; if you somehow modify it, it will also be saved in tmp, again).

Solution: simply remove logs, groovy scripts and other files from hq-plugins to other location. Tmp directory in this case is $HQ_HOME/server/hq-engine/hq-server/default/tmp/deploy/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号