如果使用maven,通常你把log4j.properties放在java或资源下? [英] If using maven, usually you put log4j.properties under java or resources?

查看:776
本文介绍了如果使用maven,通常你把log4j.properties放在java或资源下?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在使用Maven常规目录时放置log4j.properties文件的位置。有谁知道?

解决方案

src / main / resources

更新:以上回答了问题,但它不是最好的解决方案。查看其他答案和对此的意见...你可能不会发送自己的日志属性与jar,而是留给客户端(例如app-server,stage环境等)配置所需的日志记录。因此,将它放在 src / test / resources 中是我的首选解决方案。



注意: strong>说到将具体的日志配置留给客户端/用户,你应该考虑用 log4j 替换你的 slf4j app。


I am wondering where to put the log4j.properties file when using Maven conventional directory. Anyone knows?

解决方案

src/main/resources is the "standard placement" for this.

Update: The above answers the question, but its not the best solution. Check out the other answers and the comments on this ... you would probably not shipping your own logging properties with the jar but instead leave it to the client (for example app-server, stage environment, etc) to configure the desired logging. Thus, putting it in src/test/resources is my preferred solution.

Note: Speaking of leaving the concrete log config to the client/user, you should consider replacing log4j with slf4j in your app.

这篇关于如果使用maven,通常你把log4j.properties放在java或资源下?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆