Click or drag to resize

DevLog Class

The DevLog handles writing to the current application's log file.
Inheritance Hierarchy
SystemObject
  NetQuarryDevLog

Namespace:  NetQuarry
Assembly:  EAP.Core (in EAP.Core.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax
public sealed class DevLog : IDisposable

The DevLog type exposes the following members.

Constructors
  NameDescription
Public methodDevLog
Constructor
Top
Properties
  NameDescription
Public propertyDevLogOptions
Returns the options for logging from the current log settings.
Public propertyStatic memberFilename
Gets the filename currently being used by the DevLog.
Public propertyStatic memberIsDebugLogging
Returns true if the devlog is logging debug type messages
Public propertyStatic memberIsInitialized
Returns True if the log has been initialized
Public propertyIsOpen
Returns true if the log file is open
Public propertyStatic memberLogOptions
Returns the options for logging from the current log settings.
Top
Methods
  NameDescription
Public methodStatic memberClose
Closes the current log and the underlying stream.
Public methodStatic memberDateFromJavaTimestamp
Convert a date/time in millseconds since 1970 (in UTC) as used in java and the devlog, into a corresponding .Net DateTime value in the server-local TZ.
Public methodStatic memberDateToJavaTimestamp
Convert a date/time to milliseconds since 1970 (in UTC) which is what java uses and what we've always logged to the devlog.
Public methodDispose
Close the database connection(s)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
destructor
(Overrides ObjectFinalize.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberInitDevLog(String)
Overloaded. Initilize the log with default options, size, and backup file count.
Public methodStatic memberInitDevLog(String, DevLogOptions)
Overloaded. Initilize the log with default size and backup file count.
Public methodStatic memberInitDevLog(String, DevLogOptions, Int32, Int32)
Initilize the log.
Public methodStatic memberLogMessage(String, String, Exception)
Logs an exception to the DevLog
Public methodStatic memberLogMessage(String, String, String, LogMessageLevel)
Logs a warning to the devlog
Public methodStatic memberLogMessage(String, String, String, LogMessageLevel, LogCategory)
Logs a warning to the devlog
Public methodStatic memberLogMessage(String, String, String, String, LogMessageLevel)
Logs a warning to the devlog
Public methodStatic memberLogMessage(String, String, String, LogMessageLevel, LogCategory, Guid)
Logs a warning to the devlog
Public methodStatic memberLogMessage(String, String, String, String, LogMessageLevel, LogCategory, Guid)
Logs a warning to the devlog
Public methodStatic memberReadPageLog
Extract the XML for the specified thread and timespan from the current devlog.
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)
Public methodStatic memberTruncate
Truncate the current devlog.
Top
Fields
  NameDescription
Public fieldStatic memberDEFAULT_LOGFILE_MAXSIZE
Maximum size for a log file in bytes
Public fieldStatic memberDEFAULT_MAX_BACKUP_FILES
Default max number of backup files
Public fieldStatic memberDEFAULT_TRUNCATE_SPIN_COUNT
Number of times to spin without checking max size
Top
Extension Methods
  NameDescription
Public Extension MethodEqualValue
Determines if the object value is equal to another object. If the two objects are null, then this returns true. There is special handling for guid comparisons (since a guid could be a string formatted in up to 3 different ways). If the special guid handling is not performed, then the object.Equals method is used.
(Defined by EAPUtil.)
Top
Remarks

The DevLog (developer log) is configured in the application's configuration file (typically web.config). You may specify in the config file various options that control the verbosity and handling of the log file.

Options for the log from the DevLogOptions enumeration. This value should be a decimal number that represents a bitmask of one or more of the DevLogOptions values.

For example, to turn off Debug level logs, set the value to 1.

  • NoDebug|NoSQL == 5
  • NoDebug|NoInfo == 3 (note that this turns off SQL and Timing entries as well)
  • NoDebug|AutoFlush = 33 (0x00000001 | 0x00000020)
  • AutoFlush == 32 (by default the file is buffered)
  • Synchronize == 64 (by default the file allows overlapping writes)
Note Note
If you are running in the context of IIS then the logfile is specified in the web.config file. If you are running in the context of the Scheduler, then the logfile is specified in the EAP.Scheduler.exe.config file.
Examples
The following snippet shows how to log an exception to the current log.
try
{
   //--- leave the From field empty, it will default to the value configured in the studio
   mail.Send(string.Empty, sendToList, subject, body, true);
}
catch (Exception ex)
{
   //--- log the error then re-throw
   DevLog.LogMessage("XIssue.Send", "sendMailError", ex);
   throw;
}
The next snippet shows how to log a Debug level message:
DevLog.LogMessage("AppContext.Hibernate", "applicationHibernate", 
    string.Format("Application database connections are being closed. InitStack = {0}", _initSemaphore), 
    LogMessageLevel.Debug);
See Also