System.Log example?

Hello all,

Is there an example (I was not able to find one) of how to utilize System.Log properly where the log can be specified for each application, and major error/notification type?

The docs do not say how to create or send logging messages to specific log files - maybe I missed something and someone in the forum can share how to do that?

This appears to append to some pre-defined log file, but I want to choose/create my own. Does anyone have a solution and/or sample code? Mine are Console and Web projects for Windows and Linux/Rasberry Pi.

Thank you!
Tim

You would have to create your own system if you’re going to abandon the built in system logging.

I have my own, but wanted something more managed, hence the reason to look at the System. What I do not understand, is in linux for example, which log file would it be added to?

Thanks Tim,
Tim

You didn’t say you are using OS X, but something is weird in Sierra that I haven’t figured out yet: see https://forum.xojo.com/41157-system-log-vs-nslog-sierra-console

I’m also looking for doing this. Since logging has changed (in 10.13, IIRC), using Console on Mac is often meaningless. Console must be running while you log things or you don’t see them. There are applications/shell commands to view the history, but (1) you can’t see it live and (2) since this 10.13 change, too much logs are being written to the log system (I’d not even be surprised that moving the mouse is being logged… ?).
Under Windows, DebugView is buggy and the Events Viewer… well, I find it too much hard to use (not even having a search function, IIRC). Under Linux, I’ve never found a system-wide logging mechanism.

With all these reasons, I’d like to have my own logging system, where several of my apps would write to the same log file, possibly concurrently.
With the BinaryStream and TextOutputStream classes, I can’t open the same file more than once (the OS denies access, as has been for decades).
With the new Xojo.IO versions, I don’t get exceptions (nor error codes), which gives the impression both apps have write access. However, only what the first app writes to the file is being actually written to it; subsequent apps are just being ignored.

I seem to recall having read how OS X handles this for its logging mechanism; a flag a process can set to use the file more than once, but I don’t remember what it is (nor if Xojo supports this call).
And I expect Windows wouldn’t allow this, as even moving an open file is denied there.

Is it doable somehow?