Log4j中如何设置输出日志文件名和路径?
我正在使用 Log4j API 来维护 Android 应用程序中的日志。我是安卓新手。我已经下载了与此相关的 .JAR 文件。现在我想将日志文件存储到 SD 卡上。那么我应该在哪里写输出文件名&它的路径?
I am using Log4j API for maintaining logs in my Android Application. I am new to Android. I have Downloaded .JAR file regarding this. Now I want to store the log file on to SD Card. So where should I write output file name & its path ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道Log4j,但是,在Android上写入文件的简单描述是这样的:
首先,在Manifest中声明写入外部存储的权限:
然后,在你的代码中:
现在你可以在这个文件中写入任何内容。
I don't know about Log4j but, simple description of file writing on Android is like that:
first, declare permission in Manifest to write external storage :
Then, in your code:
Now You can write whatever in this file.
您需要添加附加程序(将日志附加到文件或标准输出等的位置)
在此处给出的配置xml文件中,您的兴趣就在这里
You need to add appender ( where to append the log.. to a file or standard output etc )
In the configuration xml file given here ,your interest lies here