My SQL debug log lines
L o o k s l i k e t h i s . a n d a r e v e r y h a r d t o r e a d!
There are also no valid CRLF end-of-lines in the text file, so all log lines are in one big hairy gob of nasty looking text.
I think the TZSQLMonitor.SaveToFile method needs to be "AnsiFied" for D2009 compilation, and viewing the resulting logs in Notepad or other simple text editors.
I played with the source and this seems to fix it:
{**
Saves the logging events to the specified file.
@param FileName a name of the file to write the events.
}
procedure TZSQLMonitor.SaveToFile(const FileName: string);
var
I: Integer;
Stream: TFileStream;
Temp: Ansistring;
Buffer: PAnsiChar;
begin
if not FileExists(FileName) then
Stream := TFileStream.Create(FileName, fmCreate)
else
Stream := TFileStream.Create(FileName, fmOpenWrite or fmShareDenyWrite);
try
for I := 0 to FTraceList.Count - 1 do
begin
Temp := TZLoggingEvent(FTraceList).AsString + #13#10;
Buffer := PAnsiChar(Temp);
Stream.Write(Buffer^, StrLen(Buffer) * sizeof(Ansichar));
end;
finally
Stream.Free;
end;
end;
{**
Handles a new incoming logging event.
@param Event an incoming logging event.
}
procedure TZSQLMonitor.LogEvent(Event: TZLoggingEvent);
var
LogTrace: Boolean;
Stream: TFileStream;
Temp: Ansistring;
Buffer: PAnsiChar;
begin
LogTrace := True;
DoTrace(Event, LogTrace);
if not LogTrace then Exit;
{ Store the event. }
if FMaxTraceCount <> 0 then
begin
if FMaxTraceCount > 0 then
TruncateTraceList(FMaxTraceCount - 1);
FTraceList.Add(TZLoggingEvent.Create(Event.Category, Event.Protocol,
Event.Message, Event.ErrorCode, Event.Error));
end;
{ Save the event. }
if FAutoSave and (FFileName <> '') then
begin
if not FileExists(FFileName) then
Stream := TFileStream.Create(FFileName, fmCreate)
else
Stream := TFileStream.Create(FFileName, fmOpenReadWrite or fmShareDenyWrite);
try
Stream.Seek(0, soFromEnd);
Temp := Event.AsString + #13#10;
Buffer := PAnsiChar(Temp);
Stream.Write(Buffer^, StrLen(Buffer)*sizeof(Ansichar));
finally
Stream.Free;
end;
end;
DoLogTrace(Event);
end;
Thanks!
Kevin G. McCoy
[patch_done] TZSQLMonitor logs using WideChar on D2009?
Moderators: gto, EgonHugeist, olehs
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
I hope you wanted to say 'We still need to fix the memory leaks'?You
As I told people before : I can only do what I really know about. Memory leaks is just something that's very difficult for me.
About the beta thing... It's dfficult to tell. We have a very severe problem on D2009 with the posting of strings as parameters when the prepared statements are emulated (at least for mysql, but I think this problem exists for all emulating drivers, eg Postgresql)
So those Delphi guys deciding to make String different from AnsiString just about killed us.
Mark
mdaems wrote:I hope you wanted to say 'We still need to fix the memory leaks'?You
I'll look at it when I get a chance, but my first impression was that there are some fundamental design issues causing the leaks. Any fix would be fairly invasive and likely to break other stuff.
I'll try to devote some time to it, but I have 2 major projects going, where I am the sole programmer. I am a bit buried right now - not a bad place to be in this economy, but my schedule doesn't leave me much free time.
Other than some minor weirdness with strings (easily worked around for me), 7.0 is working fine in a couple of my large projects on MySQL.
Best regards,
Kevin G. McCoy