gpt4 book ai didi

java - 如何禁用日志记录调用路径

转载 作者:搜寻专家 更新时间:2023-11-01 02:48:48 25 4
gpt4 key购买 nike

我想禁用记录所有正在调用的类/方法路径的 log4j 部分。比如……

Apr 15, 2013 10:50:52 AM com.production.tasks.ImportNewOrders checkForOrders
INFO: ------- Order #295510
Hibernate: select asset0_.id as id0_, asset0_.AssetID as AssetID0_, asset0_.barcode as barcode0_, asset0_.filename as filename0_, asset0_.orderID as orderID0_, asset0_.Priority as Priority0_, asset0_.qty as qty0_, asset0_.Status as Status0_, asset0_.TimeStamp_Received as TimeStamp9_0_, asset0_.type as type0_, asset0_.URL_Thumb as URL11_0_, asset0_.vendor as vendor0_ from production_queue.3D_Mgmt_v1_Assets asset0_ where asset0_.AssetID=?
Apr 15, 2013 10:51:04 AM com.production.utility.File download
INFO: - DecoFile downloaded from https://secure-url/165054548?user[id]=xxxxx&key=xxxx to th_1107461838.png
Apr 15, 2013 10:51:17 AM com.production.utility.File download
INFO: - DecoFile downloaded from https://secure-url/165054548?user[id]=xxxxx&key=xxxx to 1107461838.png
Hibernate: insert into production_queue.3D_Mgmt_v1_Assets (AssetID, barcode, filename, orderID, Priority, qty, Status, TimeStamp_Received, type, URL_Thumb, vendor) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Apr 15, 2013 10:51:17 AM com.production.tasks.ImportNewOrders checkForOrders

我想成为...

INFO: ------- Order #295510
Hibernate: select asset0_.id as id0_, asset0_.AssetID as AssetID0_, asset0_.barcode as barcode0_, asset0_.filename as filename0_, asset0_.orderID as orderID0_, asset0_.Priority as Priority0_, asset0_.qty as qty0_, asset0_.Status as Status0_, asset0_.TimeStamp_Received as TimeStamp9_0_, asset0_.type as type0_, asset0_.URL_Thumb as URL11_0_, asset0_.vendor as vendor0_ from production_queue.3D_Mgmt_v1_Assets asset0_ where asset0_.AssetID=?
INFO: - DecoFile downloaded from https://secure-url/165054548?user[id]=xxxxx&key=xxxx to th_1107461838.png
INFO: - DecoFile downloaded from https://secure-url/165054548?user[id]=xxxxx&key=xxxx to 1107461838.png
Hibernate: insert into production_queue.3D_Mgmt_v1_Assets (AssetID, barcode, filename, orderID, Priority, qty, Status, TimeStamp_Received, type, URL_Thumb, vendor) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

目前我还没有配置 log4j 属性文件。我想保持 INFO 原样发送到 stdout,但只是避免这些方法调用日志。

更新

我已经创建了一个 log4j.properties 文件,但我找不到任何设置来禁用方法调用的日志记录。

注意;我不是要更改日志消息的“格式”,而是要完全禁用方法调用的日志记录。

log4j.rootLogger=INFO, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c:%L - %m%n

#prevent "no appenders" warning despite having appenders - http://stackoverflow.com/a/15912258/197606
log4j.category.org.jboss.logging=INFO, stdout

#log4j.category.org.springframework=DEBUG,stdout
log4j.category.com.model.entity =DEBUG,stdout

最佳答案

那些不是 log4j 调用。您看到的是默认的 java.util.logging 模式(到 stderr)。所以你需要适本地配置 java.util.logging。参见 http://tutorials.jenkov.com/java-logging/configuration.html

关于java - 如何禁用日志记录调用路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16018496/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com