Class NTEventLogListener
java.lang.Object
com.iizix.server.NTEventLogListener
- All Implemented Interfaces:
ILogHistoryListener
The server log's listener that forwards entries to the Windows NT Event Log (CC-SERVER-RESTART-UPDATE-V5, stage F; NetPhantom's
DefaultEventExit filter): SEVERE becomes an error event, WARNING a warning event, INFO an informational event only with the level NTEventLogListener.Level.INFO; CONFIG through FINEST never go. The start options are -ntEventLog off|on|info (default off) and -ntEventSource <name> (default iiziServer), on the command line only (D-21): they are in force before the server settings load, so the first SEVERE of a failing start reaches the event log.install(File, ServerLogger) enables the log only when the event source is registered, and says so in the server log when it is not: the DLL ends the process (exit code 10) when it has to register the source itself and cannot.
- Author:
- Christopher Mindus
Nested Class Summary
Nested ClassesConstructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionstatic inteventClass(int logLevel, NTEventLogListener.Level l) Maps a log level to an event class.Gets the level.static NTEventLogListener.LevelgetLevel()Gets the level of the start option.static StringGets the event source of the start option.static NTEventLogListenerinstall(File currentDirectory, ServerLogger logger) Installs the listener on a server's logger when the start option asks for it: on Windows, with the event source registered and the DLL of this architecture present.voidCalled when a new history entry is added.voidCalled when the history has been reinitialized due to e.g.static voidSets the level from the start option.static voidSets the event source from the start option.
Constructor Details
NTEventLogListener
Constructor.- Parameters:
eventLevel-NTEventLogListener.Level.ONorNTEventLogListener.Level.INFO.
Method Details
setLevel
Sets the level from the start option. Not intended to be called but by the launcher.- Parameters:
l- The level, null forNTEventLogListener.Level.OFF.
getLevel
Gets the level of the start option.- Returns:
- The level.
setSource
Sets the event source from the start option. Not intended to be called but by the launcher.- Parameters:
name- The source, null or blank for the default.
getSource
eventClass
Maps a log level to an event class.- Parameters:
logLevel-ILog.SEVERE..ILog.FINEST.l- The event-log level.- Returns:
- The event class, or 0 when the entry does not go to the event log.
install
Installs the listener on a server's logger when the start option asks for it: on Windows, with the event source registered and the DLL of this architecture present. Says in the server log why not otherwise, and never fails the start.- Parameters:
currentDirectory- The server's current directory: the installation.logger- The server's logger.- Returns:
- The listener installed, or null.
getEventLevel
onInitialized
public void onInitialized()Description copied from interface:ILogHistoryListenerCalled when the history has been reinitialized due to e.g. log file rotation.- Specified by:
onInitializedin interfaceILogHistoryListener
onEntry
Description copied from interface:ILogHistoryListenerCalled when a new history entry is added. This method is only called from the logger queue purger thread, so it is safe to get the history or to manipulate the history at this point. There is no thread synchronization when this method is called.- Specified by:
onEntryin interfaceILogHistoryListener- Parameters:
entry- The entry.