简体   繁体   English

如何在Net Beans中设置log4j 2?

[英]How to setup log4j 2 in Net Beans?

I am new to log4j 2. Can anyone please help me in setting up log4j 2 in Net Beans. 我是log4j的新手2.任何人都可以帮我在Net Beans中设置log4j 2。 I have searched everything on the internet and didn't help me. 我在互联网上搜索了一切并没有帮助我。 I have added a log4j properties file in my Net Beans Project and also a sample main program. 我在我的Net Beans项目中添加了一个log4j属性文件,还有一个示例主程序。

I even added classpath by right-clicking on the project -> properties->Libraries->add jar/folder. 我甚至通过右键单击项目 - > properties-> Libraries-> add jar / folder添加了classpath。

My question is that whether I need to extract the zip file and add the folder or simply add the zip? 我的问题是,我是否需要提取zip文件并添加文件夹或只是添加zip?

I have done the both ways but the import statement in the sample program is showing that no package with " org" found. 我已经完成了两种方式,但示例程序中的import语句显示没有找到包含“org”的包。 Can anyone please help me in this.Below links are the screenshots of my sample program and log4j properties file. 任何人都可以帮助我.Below链接是我的示例程序和log4j属性文件的屏幕截图。

This is my sample program with error showing at import statement: 这是我的示例程序,在import语句中显示错误:

This is my properties file 这是我的属性文件

Please give a very clear step-wise instructions.Thank you. 请给出非常明确的逐步说明。谢谢。

NetBeans supports log4j,but it is very hard to migrate log4j into Netbeans. NetBeans支持log4j,但将log4j迁移到Netbeans非常困难。 For knowing this it took 3 days after searching the entire internet. 要知道这一点,搜索整个互联网需要3天。 Please download Eclipse. 请下载Eclipse。 You can use log4j in eclipse. 你可以在eclipse中使用log4j。 Eclipse is the only one which is directly built in JAVA. Eclipse是唯一一个直接在JAVA中构建的Eclipse。 SO it supports more libraries than NetBeans. 因此它支持的库比NetBeans多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM