1
votes

I just read the Api of class Log and tried it out but I did not succeed at all. 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"

Afterwards nothing happened. Where is the log content sent to? In the JavaDoc there's a hint that it is sent to cloud. Which cloud? Is it possible that the app has no rights to write to "/home" directory?

Then I tried to send it by eMail:

Message m = new Message("Body of message");
m.getAttachments().put(Log.getInstance().getFileURL(), "text/plain");
Display.getInstance().sendMessage(new String[]{"[email protected]"}, "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. Maybe because there's no log file existing?

Any suggestions? I need it.

1

1 Answers

0
votes

Log.sendLog is a pro feature. It conflicts with features such as setFileURL.

The approach with the attachment should work, I'm not sure what's failing for you there.