Print Page | Close Window

LogWriter

Printed From: IdeaBlade
Category: Cocktail
Forum Name: Community Forum
Forum Discription: A professional application framework using Caliburn.Micro and DevForce
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3853
Printed Date: 25-Mar-2025 at 6:27pm


Topic: LogWriter
Posted By: gregweb
Subject: LogWriter
Date Posted: 12-Dec-2012 at 2:17pm
The LogFns in TempHire don't seem to be putting out anything to my Output window. Is there a switch somewhere? Am running in Debug.

Greg



Replies:
Posted By: mgood
Date Posted: 12-Dec-2012 at 2:36pm
Greg,
The release build of the Cocktail assemblies does not log to the output window. That code gets optimized away by the compiler. You have two options. You can create your own custom logger as described here:

http://drc.ideablade.com/devforce-2012/bin/view/Documentation/custom-logger

and then log using LogFns.TraceWriteLine and LogFns.TraceWriteLineIf. The tracing methods work in the release build. 

The second option is to build the debug Cocktail assemblies from the source code yourself and reference them from your code. 


Posted By: gregweb
Date Posted: 12-Dec-2012 at 3:53pm
Got it, thanks.

Greg


Posted By: gregweb
Date Posted: 12-Dec-2012 at 3:56pm
By the way, I enjoyed watching all the Temp Hire videos that you and Ward did - it was very helpful to see a high level walkthrough of a very sophisticated framework.


Posted By: nihique
Date Posted: 15-Dec-2012 at 4:04pm
Hi Marcel,

I am doing Cocktail tutorial HappyHour and it looks very good, but I have same problem like Greg - cannot see messages in output window when using Nuget package. Is there a way how to still use Nuget and get them? They dont have to be in output window, I very much prefer custom logfile, so I can view it on second monitor...

I cannot/don't want overwrite packages manually, this is very nasty and it will not work for other team members - we are using nuget package download on build.


Posted By: mgood
Date Posted: 16-Dec-2012 at 12:15am
In addition to installing your own TraceLogger as described above you can install your own logger for Caliburn.Micro by assiging it to LogManager.GetLog.
 
You can use the DefaultDebugLogger as guidance for how to implement a logger for Caliburn.Micro.
 
https://github.com/IdeaBlade/Cocktail/blob/master/Cocktail/DefaultDebugLogger.cs - https://github.com/IdeaBlade/Cocktail/blob/master/Cocktail/DefaultDebugLogger.cs


Posted By: nihique
Date Posted: 16-Dec-2012 at 8:56am
thank you, I am using debug builds for now


Posted By: mgood
Date Posted: 16-Dec-2012 at 9:24am
Great. I rarely need the diagnostics output, but if I do I simply override the assemblies in my local packages folder with the debug assemblies. That way nothing has to change in the projects and the build server will continue to build against the release assemblies.



Print Page | Close Window