log4j

log4j Logger messages are not displayed on JBoss webapp

 ̄綄美尐妖づ 提交于 2019-12-05 18:41:23
I use Jboss 6 and my static Logger logger = Logger.getLogger(Foo.class); displays nothing Tried adding log4 to my project, removing it, placing a log4j file on my main/resources folder, placing no log4j file and no results. Only System.Out seems to work, but it doesn't provide all the information I would like to see I even see Hibernate log working but not mine What am I missing? Turns out my logging does work. Hibernate logging is controlled by the jboss logging settings. My logging began to work as soon as I placed the log4j on right next to the classes folder, and placing log4j jar with the

how to use Kafka 0.8 Log4j appender

假装没事ソ 提交于 2019-12-05 18:39:16
问题 I am trying to run Kafka-0.8 Log4j appender and I am unable to make it. I want my application to send log directly to kafka via Log4j appender. Here is my log4j.properties. I couldn`t find any proper encoder, so I just configure it to use default encoder. (e.g I commented the line.) log4j.rootLogger=INFO, stdout, KAFKA log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:

How can I tell where is Log4j picking its configuration from

僤鯓⒐⒋嵵緔 提交于 2019-12-05 18:35:00
Is there a way to figure out where is Log4J picking the configuration file from? I tried to change my log4j.xml and the changes were not reflected in Log4j behaviour. I deleted log4j.xml and funnily enough, Log4J is still working with the old behaviour. So it must be picking some configuration file which is available in my namespace. But the question is how can I figure out which one. Is there a way to do that? there are so many different dependencies on jars etc, so one of them must contains a log4j.xml or log4j.properties that is overriding my changes. Any ideas? When running your

Log4j2 - how to convert XML configuration to .properties format for JDBC appender

余生颓废 提交于 2019-12-05 18:23:19
How do I convert this log4j2.xml config fragment to log4j2.properties format? I cannot use XML format in my maven + netbeans project as I simply cannot get log4j2 to parse and respond to a log4j2.xml file - no matter where I place it in my project, it is ignored by log4j2. However log4j2.properties in main/resource IS parsed and responded to so I -HAVE- to use .properties...: <JDBC name="databaseAppender" tableName="LOGGING.APPLICATION_LOG"> <ConnectionFactory class="log4j_tutorial.ConnectionFactory" method="getDatabaseConnection" /> <Column name="EVENT_DATE" isEventTimestamp="true" /> <Column

Log4j configuration(Size Based) not working

社会主义新天地 提交于 2019-12-05 17:55:52
I have my application for which the below entry is done in Log4j properties file.Size based rolling is not working for this application. File does not rollover at 5 MB and the application keeps on logging and making it in GB. In one run approximately 6 MB of log is generated.The application runs multiple times a day. Can someone help in pointing out where I am doing a mistake? # SampleApp configuration log4j.category.com.ibm.hmel.hwmmphdya=INFO, SampleApp log4j.additivity.com.ibm.hmel.hwmmphdya=false log4j.appender.SampleApp =org.apache.log4j.rolling.RollingFileAppender log4j.appender

druid-springboot-starter默认启用监控页面,公网项目可能泄漏DB信息

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 17:43:00
1. 问题描述 druid是国内及公司内部最常用的数据库连接池配置管理工具;其内置监控页面,用于拦截sql及实时监控连接池/sql信息,该页面在原生的druid包中默认为禁用,但其用于适配springboot的druid-spring-boot-starter包,默认打开该监控页面( http://ip:port/druid/index.html ) ,打开后存在如下风险: 1.1 暴露DB信息 由于druid监控页面地址是固定的,容易被猜,监控页面默认没有任何安全措施,容易暴露项目信息,如:数据库域名地址、库名、表名、查询的sql及url等,如果druid有漏洞,甚至可能被攻击。 泄漏DB域名、使用用户及库名: 泄漏SQL信息: 泄漏URL信息: 1.2 成为非法广告的肉机 监控页面中的多个tab页含阿里云广告,且power by连接到作者个人域名,估计没续费,已被澳门赌场站点抢占,国内该类广告是违法的,如下图: 2. 影响范围 springboot项目:该问题我们已向官方提交request官方尚未修复,所以我们使用的任意版本druid-spring-boot-starter都有问题。 非sprinboot项目:如果手工启用监控页面,且未指定登录用户名、密码及允许访问的IP,也存在相同问题。 3. 解决办法 判断项目是否添加druid监控页面的方法:是否能打开druid监控页面(

Log4j: configure JDBC appender to use Datasource

两盒软妹~` 提交于 2019-12-05 16:44:54
I have to configure the JDBC appender to use a datasource..is it possible? if so , how? My present file looks like so: # Define the root logger with file appender log4j.rootLogger = DEBUG, sql # Define the file appender log4j.appender.sql=org.apache.log4j.jdbc.JDBCAppender log4j.appender.sql.URL=jdbc:mysql://localhost/test # Set Database Driver log4j.appender.sql.driver=com.mysql.jdbc.Driver # Set database user name and password log4j.appender.sql.user=root log4j.appender.sql.password=password # Set the SQL statement to be executed. log4j.appender.sql.sql=INSERT INTO LOGS VALUES ('%x', now() ,

Apache Log4j Logging with specific timezone

非 Y 不嫁゛ 提交于 2019-12-05 16:40:10
问题 I want the log should contain date entries of specific timezone. Is there any way of forcing timezone in log4j.properties ? Now I am using JDK 1.5, As you already know that there is timezone bug in JDK 1.5 that is removed in JDK 1.5. In case of JDK 1.5 it by default shows "GMT" timezone. I want to configure in Log4j my specific timezone. 回答1: This will allow you to see timezone information in each line of your logs: %d{yyyy-MM-dd/HH:mm:ss.SSS/zzz} The trick is to include 'zzz' in the pattern

Is SLF4J good to be used in a multithreaded application for logging to a database?

老子叫甜甜 提交于 2019-12-05 16:33:23
I am working on a multithreaded application. I am already using Log4j to log statements to files. I have been recently looking into the possibility of logging to a Mysql database. The logging component has to be reliable under a heavy load and has to be thread safe. I heard of SFL4J. My understanding of SLF4J is that is just a facade or abstraction layer. I was wondering if SLF4J was a good database logging solution to use in a multithreaded application? And in the case of a heavy load, would it be a good idea to add a layer (like a buffer or a queue) and let the threads log to it instead of

Log4j:how to define a common layout and ConversionPattern for multiple appenders

折月煮酒 提交于 2019-12-05 16:23:00
问题 I have multiple appenders in my log4j config, and I was wondering whether it would be possible to define the layout and conversion pattern once for all of them . I.e. I have log4j.appender.CA=org.apache.log4j.ConsoleAppender log4j.appender.CA.layout=org.apache.log4j.PatternLayout log4j.appender.CA.layout.ConversionPattern=%d{yyyy/MM/dd HH:mm:ss} %-5p %c %x - %m%n log4j.appender.FA=org.apache.log4j.RollingFileAppender log4j.appender.FA.MaxBackupIndex=0 log4j.appender.FA.MaxFileSize=100Mb log4j