PDA

View Full Version : When is log data written to a file?


redsnapper
20-May-2005, 11:09 AM
Hi we use the following code
(See below)
When teh method HandleStandardApplicationException is called the exception data is not yet written to the output log.
In the HandleStandardApplicationException method we send the log file to us, but because the data isn't written yet we are always 1 message behind.

Can we force the write to the log file??

regards
Paul Sjoerdsma
--------------------------------

procedure PSPGeneralExceptionHandler(ExcRecord: TEurekaExceptionRecord; var
Handled: Boolean);
begin
ExcRecord.CurrentModuleOptions.OutputPath := PSPExceptionLogFilename;
{ We do not need to let the general exception manager handle this once again}
Handled := True;

// We only need to handle certain exceptions here, the other ones are part
// of the internal exception structure
if (ExcRecord.ExceptionObject is EPSPInvalidUserSession) or
(ExcRecord.ExceptionObject is EPSPSecurityException) or
(ExcRecord.ExceptionObject is EPSPBackupRestoreException) or
(ExcRecord.ExceptionObject is EPSPSessionException) or
(ExcRecord.ExceptionObject is EPSPVersionMismatch) or
(ExcRecord.ExceptionObject is EPSPLoginException) or
(ExcRecord.ExceptionObject is EPSPValidationException) then
begin
HandleStandardApplicationError(ExcRecord);
// Check once again for an invalid user session

if ExcRecord.ExceptionObject is EPSPSessionException then
begin
// Now set the invalid flag in the user's session data
PSPGetUsersessionSingleton.HasExpired := True;
// Handle this exception in a different way
ShowMessage(PSPGetMessageManagerSingleton.GetMessa ge(ERR_SessionHasExpired));
end; // if
end
else if (ExcRecord.ExceptionObject is EROException) then
begin
if Exception(ExcRecord.ExceptionObject).Message =
'A connection with the server could not be established' then
begin
PSPGetUsersessionSingleton.HasExpired := True;
end;
HandleStandardApplicationException(ExcRecord);
end
else
begin
HandleStandardApplicationException(ExcRecord);
end;
end;

...........


begin
if IsEurekaLogInstalled then
begin
SetEurekaLogState(True);
CurrentEurekaLogOptions.ShowExceptionDialog := False;
CurrentEurekaLogOptions.ActivateLog := True;
CurrentEurekaLogOptions.SaveLogFile := True;
CurrentEurekaLogOptions.FreezeActivate := False;
CurrentEurekaLogOptions.OutputPath := PSPTemporaryFolder;
ExceptionNotify := PSPGeneralExceptionHandler;
end;
end.

admin
20-May-2005, 06:17 PM
The Log File is saved after the ExceptionActionNotify event, Action=atSavedLogFile.

Use this event for send the log-file, ok? :)