- Integer, the level of logging.
- String, the message to be logged.
You can find 9 constants for that number in System.LogLevelXXX:
- LogLevelEmergency = 1000
- LogLevelAlert = 1001
- LogLevelCritical = 1002
- LogLevelError = 1003
- LogLevelWarning = 1004
- LogLevelNotice = 1005
- LogLevelInformation = 1006
- LogLevelDebug = 1007
- LogLevelSuccess = 1008
Note that this is different than the 6 log levels used by the Apache Commons Logging project. You might think that after a few decades the computing industry would standardize on this stuff, but no.
Example usage:
System.Log( System.LogLevelInformation, "Your Message Goes Here" )
Messages you pass appear in the host OS' logging tools. On Mac OS X Snow Leopard 10.6:
- Run the "Console" app.
- Click the "Show Log List" toolbar button.
- Select the first item beneath "Files": "system.log".
Your messages should appear there.
One BIG catch with this facility: Not all the log level constants work on Mac OS X. As documented, and as tested by me in REAL Studio 2010 Release 5, the 3 most benign log levels fail on a Mac:
- LogLevelInformation = 1006
- LogLevelDebug = 1007
- LogLevelSuccess = 1008
- LogLevelEmergency = 1000
- LogLevelAlert = 1001
- LogLevelCritical = 1002
- LogLevelError = 1003
- LogLevelWarning = 1004
- LogLevelNotice = 1005
No comments:
Post a Comment