NET Logging Library
Flush Method (ConcreteLog)
Example 



KellermanSoftware.NetLoggingLibrary Namespace > ConcreteLog Class : Flush Method
Wait for the specified number of milliseconds for asynchronous loggers to flush
Syntax
Public Function Flush( _
   ByVal maxMillisecondsToWait As Integer _
) As Boolean
Dim instance As ConcreteLog
Dim maxMillisecondsToWait As Integer
Dim value As Boolean
 
value = instance.Flush(maxMillisecondsToWait)
public bool Flush( 
   int maxMillisecondsToWait
)
public:
bool Flush( 
   int maxMillisecondsToWait
) 

Parameters

maxMillisecondsToWait
Example
ConcreteLog logger = new ConcreteLog();
 
//Licensed Mode
//logger.UserName = "User Name From Receipt";
//logger.LicenseKey = "LicenseKey From Receipt";            
 
//Clear all configuration
logger.ResetConfiguration();
 
//Add a new target, you can also define targets in an xml file, app.config, or web.config
FileTarget fileTarget = new FileTarget(Environment.CurrentDirectory + "\\fileLogger.txt");
fileTarget.Mode = LoggingMode.Asynchronous;         
 
//Add it to the targets
logger.Config.Targets.Add(fileTarget);
 
//For the file target, this is a non blocking operation, it will be written on a seperate thread
logger.Debug("This is a test");
 
//Parameters
int maxMillisecondsToWait = 1000;
 
//Wait a second for it to be written
bool wasFlushedDuringTheWaitTime = logger.Flush(maxMillisecondsToWait);
 
Console.WriteLine(wasFlushedDuringTheWaitTime);
Dim logger As New ConcreteLog()
 
'Licensed Mode
'logger.UserName = "User Name From Receipt";
'logger.LicenseKey = "LicenseKey From Receipt";            
 
'Clear all configuration
logger.ResetConfiguration()
 
'Add a new target, you can also define targets in an xml file, app.config, or web.config
Dim fileTarget As New FileTarget(Environment.CurrentDirectory & "\fileLogger.txt")
fileTarget.Mode = LoggingMode.Asynchronous
 
'Add it to the targets
logger.Config.Targets.Add(fileTarget)
 
'For the file target, this is a non blocking operation, it will be written on a seperate thread
logger.Debug("This is a test")
 
'Parameters
Dim maxMillisecondsToWait As Integer = 1000
 
'Wait a second for it to be written
Dim wasFlushedDuringTheWaitTime As Boolean = logger.Flush(maxMillisecondsToWait)
 
Console.WriteLine(wasFlushedDuringTheWaitTime)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

ConcreteLog Class
ConcreteLog Members