log4j

Multiple log4j.properties files

馋奶兔 提交于 2019-12-11 02:58:45
问题 This might not seem a valid question but I have a requirement here. Below is my project structure: common (built as a jar) module-1 (war, includes common.jar in its classpath) module-2 (war, includes common.jar in its classpath) module-3 (war, includes common.jar in its classpath) module-4 (war, includes common.jar in its classpath) The deployment is like below: module-1 and module-2 is on one server and module-3 and module-4 on another. The requirement is to have two separate log files(one

How to log final SQL queries with hibernate

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 02:56:12
问题 Is it possible to log not HQL queries but final queries when using hibernate. I mean, the one that is sent to the database. I've tried different log level but I haven't seen it. And in my opinion it would be useful to debug some issues. Thank you very much. 回答1: Yes, it's possible. That's what the hibernate.show_sql property does. You may also have finer control using the logging configuration: org.hibernate.SQL Log all SQL DML statements as they are executed org.hibernate.type Log all JDBC

log4j migration to log4j2

戏子无情 提交于 2019-12-11 02:45:54
问题 Log4j migration guide https://logging.apache.org/log4j/2.x/manual/migration.html states that Calls to org.apache.log4j.Logger.getLogger that accept a LoggerFactory must remove the org.apache.log4j.spi.LoggerFactory and use one of Log4j 2's other extension mechanisms. What are the extension mechanisms available in log4j2 and how best to migrate a method like below in log4j2 private static TraceLoggerFactory stTraceFactory = new TraceLoggerFactory(); public static Logger getTraceLogger(final

Can't set LevelRangeFilter for log4j

牧云@^-^@ 提交于 2019-12-11 02:34:39
问题 I am using this property file to setup log4j in Spring: log4j.appender.EMAIL=org.apache.log4j.net.SMTPAppender log4j.appender.EMAIL.filter=org.apache.log4j.varia.LevelRangeFilter log4j.appender.EMAIL.filter.levelMin=FATAL but getting: log4j:WARN Failed to set property [filter] to value "org.apache.log4j.varia.LevelRangeFilter". Any ideas? 回答1: From the docs for PropertyConfigurator: The PropertyConfigurator does not handle the advanced configuration features supported by the DOMConfigurator

Log4j StringMatchFilter and denyAll filter properties configuration

Deadly 提交于 2019-12-11 02:27:02
问题 Can anyone please let me know filter properties for a package where I want to separate the logs in two different logs files. Below is the configuration which I am trying use but its not working. I want deny logs based string like 'UserMgmt-' and allow rest logs in log1 appender and allow only log2 appender allow 'UserMgmt-' and deny rest allow logs. log4j.logger.com.abc=DEBUG, log1 log4j.logger.com.abc=DEBUG, log2 log4j.appender.log1=org.apache.log4j.RollingFileAppender log4j.appender.log1

Websphere Application Debug logging

孤人 提交于 2019-12-11 02:06:03
问题 I am trying to get my web application deployed on Websphere 6.1 to display debug level logs. Originally I was using log4j, but have changed all loggers to use commons logging since it seems this is supported by Websphere. I have set the log level under Logging and Tracing > server1 > Change Log Detail Levels to: *=info: com.myapplication.*=all Unfortunately this only seems to display info level logs from my application in the SystemOut.log The following shows up in the logs: if (log

Disable JBoss 5 logging to the console

老子叫甜甜 提交于 2019-12-11 01:30:07
问题 I still have to deal with JBoss 5 where I want to disable the logging to the console. I found in jboss-log4j.xml the appender "CONSOLE". <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/> <param name="Target" value="System.out"/> <param name="Threshold" value="FATAL"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/> </layout> </appender>

Logging the PID in log4j2 without using thread context

烂漫一生 提交于 2019-12-11 00:59:02
问题 I need to include the PID in my log4js logs. I see many examples which use the thread context. However, these need to be set on each individual thread created. I am constrained against doing this. I need a solution that, either, does not use the thread context, or, can set the PID on all thread contexts, for any thread that may be created, from any arbitrary class. 回答1: Please create a feature request on the Log4j2 issue tracker to make this a built-in feature. For now, you can create a

How to refresh log4j after change of the external class logging level at runtime

偶尔善良 提交于 2019-12-10 23:58:50
问题 I have some warnings which I want to disable. They comes from the org.eclipse.lyo.oslc4j.provider.jena.JenaModelHelper class. So I am using log4j and I call at rutime Logger.getLogger("org.eclipse.lyo.oslc4j.provider.jena.JenaModelHelper").setLevel(Level.OFF); but nothing happens. For that purpose I debug the problematic code and first 3 times the warn was displayed, but on the 4-th hit the level was changed. I changed the log level at the begging(in the constructor) so I suppose there is

Cannot find the log4j siftAppender output logs

偶尔善良 提交于 2019-12-10 23:55:24
问题 I followed this tutorial I have this code, but no log file was written. What am i missing? here is my code: https://github.com/elad2109/log4j_sift/blob/master/src/main/java/com/waze/rr_logger/SiftExampleLog4j.java import org.apache.log4j.Logger; import org.slf4j.LoggerFactory; public class SiftExampleLog4j { static org.apache.log4j.Logger logger = Logger.getLogger(SiftExampleLog4j.class); public void log() { BasicConfigurator.configure(); org.apache.log4j.MDC.put("session_id","MyGooApp");