简体   繁体   English

CodenameOne发送日志文件

[英]CodenameOne send log file

I just read the Api of class Log and tried it out but I did not succeed at all. 我只是阅读了Log类的Api并试了一下,但我根本没有成功。 I tried the following code with the emulator: 我用模拟器尝试了以下代码:

    String appHomePath = FileSystemStorage.getInstance().getAppHomePath();
    String fileName = (appHomePath + "codenameOne.log");
    Log.getInstance().setFileURL(fileName);
    Log.p("This is a stupid log message!");
    Log.getInstance().sendLog();

appHomePath gets value "file://home/" so the URL which is set for the log files is "file://home/codenameOne.log" appHomePath获取值"file://home/"因此为日志文件设置的URL是"file://home/codenameOne.log"

Afterwards nothing happened. 之后什么也没发生。 Where is the log content sent to? 日志内容发送到哪里? In the JavaDoc there's a hint that it is sent to cloud. 在JavaDoc中有一个暗示它被发送到云。 Which cloud? 哪个云? Is it possible that the app has no rights to write to "/home" directory? 应用程序是否可能无权写入“/ home”目录?

Then I tried to send it by eMail: 然后我尝试通过eMail发送它:

Message m = new Message("Body of message");
m.getAttachments().put(Log.getInstance().getFileURL(), "text/plain");
Display.getInstance().sendMessage(new String[]{"dummy@address.de"}, "Log file", m);

This leads to an eMail client window opened with correct address and body text but there's no log file attachment at all. 这导致打开的eMail客户端窗口具有正确的地址和正文,但根本没有日志文件附件。 Maybe because there's no log file existing? 也许是因为没有日志文件存在?

Any suggestions? 有什么建议么? I need it. 我需要它。

Log.sendLog is a pro feature. Log.sendLog是专业版功能。 It conflicts with features such as setFileURL . 它与setFileURL等功能冲突。

The approach with the attachment should work, I'm not sure what's failing for you there. 附件的方法应该有效,我不确定那里有什么失败。

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

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