Overview
Features
Download
Documentation
Community
Add-Ons & Services

Configuring Logger to display where message is coming from

A general discussion forum.

Configuring Logger to display where message is coming from

Postby sampsont » 01 May 2009, 23:09

I am using the following format pattern with the logger: <pattern>%s, %p - %t</pattern>

An example of the output is:
Application::instance().logger().information("Initializing DFT hardware");
Application, Information - Initializing DFT hardware

The %s format causes 'Application' to be printed. This is the the base class that I'm using. I would like to add to this the name of the class where the log command was executed. Is this possible?

The output might look something like:

Application, myClass1, Information - Initializing DFT hardware
Application, myClass2, Information - Initializing more DFT hardware

Would I have to make a separate logger for each class? I hope not. I hope a logger can automatically detect the name of the class.

Thanks!
todd
sampsont
 
Posts: 31
Joined: 05 Mar 2009, 17:08

Re: Configuring Logger to display where message is coming from

Postby alex » 04 May 2009, 13:28

sampsont wrote:Would I have to make a separate logger for each class?


Yes.
alex
 
Posts: 1146
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron