- This topic has 5 replies, 2 voices, and was last updated 2019-07-15 at 7:48 pm by Carl Yang.
-
AuthorPosts
-
-
April 16, 2019 at 11:00 pm #1307
Hello,
I use Delphi XE4 with codesite express, I can write log file and enable live viewer when codesite used in Delphi maked exe.
But when I use it in DLL called by c# application, the file and viewer will not work. Until I used debug mode(set Host application as c# application and run the dll with debug mode)
Below are my codes:
CodeSite.Enabled := CodeSite.Installed; if CodeSite.Enabled then begin try Destination := TCodeSiteDestination.Create(nil); except on e:exception do showmessage(format('destination create fail:%s',[e.message])); end; // showmessage('dest create ok'); Destination.LogFile.Active := True; Destination.LogFile.MaxSize:=4096; Destination.LogFile.MaxParts:=2; Destination.LogFile.FileName :=ChangeFileExt('PMS_DLL', '.csl');//'PMS.csl'; Destination.LogFile.FilePath := '$(MyDocs)\My CodeSite Files\Logs\'; Destination.Viewer.Active := {false;//}True; CodeSite.Destination := Destination; CodeSiteManager.DefaultDestination:=Destination; CodeSite.Destination.Viewer.Active:=true; CodeSite.Clear; CodeSite.sendmsg('test msg'); end;
-
April 17, 2019 at 1:33 am #1308
Hi all,
After reinstall the codesite, the problem is solved !
BR
-
April 17, 2019 at 3:13 pm #1312
Hi Carl,
Glad you have it working again. I do have a couple comments regarding the code you posted. In your code, you are creating a new Destination object and you are assigning it to both the CodeSite global logger and the CodeSiteManager. By default, each logger instance uses the destination that is defined in the CodeSiteManager. This happens when the logger’s Destination property is nil. By assigning the CodeSite.Destination to a new TCodeSiteDestination instance, you are disconnecting it from the CodeSiteManager.Ray
-
April 17, 2019 at 8:04 pm #1313
Hi Ray,
Thanks a lot for your reply !
My purpose is to set the log file output to a dedicate file.
Could you tell me what is the default way to update my codes ?
And as your suggest, what kind of situation will I get when the global codesite disconnect from CodeSiteManager ?I had comment out the code:
`//CodeSiteManager.DefaultDestination:=Destination;
`
And the log viewer and log file can show and output normally.Any suggest would be appreciated.
Best regards,
Carl
- This reply was modified 5 years, 7 months ago by Carl Yang.
-
April 27, 2019 at 12:19 am #1323
Hi Carl,
By disconnecting from the CodeSiteManager, I mean that if you change the CodeSiteManager.DefaultDestination then the logger instance will not use any of those changes.Setting the CodeSiteManager.DefaultDestination to the new TCodeSiteDestination instance will result in all logger instances using the same destination information.
To log your CodeSite messages to just a log file, you simply create a TCodeSiteDestination instance and only activate the LogFile destination sub-type. An example of this is shown in the Getting Started section of the CodeSite Help.
Ray
-
July 15, 2019 at 7:48 pm #1410
Hi Ray,
I am very sorry to reply so lately.Now I understand your suggestion and sincere thanks for correct usage on Codesite !
Carl
-
-
AuthorPosts
- You must be logged in to reply to this topic.