DICOM @ OFFIS

Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Sat, 2017-07-22, 03:48

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed, 2017-04-05, 16:31 
Offline

Joined: Tue, 2005-02-01, 22:53
Posts: 35
Hello,

I am currently following the FAQ for using OFlog.

FAQ
http://support.dcmtk.org/docs/mod_oflog.html

My code is a simple as below :

Code:
OFLogger logger = OFLog::getLogger("log4cplus_configure.ini");
OFLOG_DEBUG(logger, "DCMTK version " << OFFIS_DCMTK_VERSION);


And my configurations file (log4cplus_configure.ini) is as below :

Code:
###################################
########Define log Levels##########
###################################

#All classes - except those in log4cplus.logger.* - use DEBUG level to print information on file
log4cplus.rootLogger=DEBUG, MyFileAppender

#For MemoryCheck class I need to inspect all the details, and I want print information even to the console
log4cplus.logger.MemoryCheck=TRACE, MyConsoleAppender

#For database stuff, I don't need to logging everything, it's enough printing only errors!
log4cplus.logger.DatabaseOperations=ERROR

###################################
########Define the Appenders#######
###################################

#MyConsoleAppender:
log4cplus.appender.MyConsoleAppender=log4cplus::ConsoleAppender
log4cplus.appender.MyConsoleAppender.layout=log4cplus::PatternLayout
log4cplus.appender.MyConsoleAppender.layout.ConversionPattern=[%-5p][%d] %m%n

#MyFileAppender
log4cplus.appender.MyFileAppender=log4cplus::RollingFileAppender
log4cplus.appender.MyFileAppender.File=D:\Z\Testdcmtk.log
log4cplus.appender.MyFileAppender.MaxFileSize=16MB
log4cplus.appender.MyFileAppender.MaxBackupIndex=1
log4cplus.appender.MyFileAppender.layout=log4cplus::PatternLayout
log4cplus.appender.MyFileAppender.layout.ConversionPattern=[%-5p][%D{%Y/%m/%d %H:%M:%S:%q}][%-l][%t] %m%n


I can't figure out why there is no log produced.
I have no linking error using dcmtk.

Thanks for your help

Kattabomane


Top
 Profile  
 
PostPosted: Fri, 2017-04-07, 17:15 
Offline
DCMTK Developer

Joined: Tue, 2011-05-03, 14:38
Posts: 1831
Location: Oldenburg, Germany
Seems that you are mixing up logger name and logging configuration filename (you use "log4cplus_configure.ini" for both). Where do you load the configuration file?


Top
 Profile  
 
PostPosted: Sat, 2017-04-08, 10:51 
Offline

Joined: Tue, 2005-02-01, 22:53
Posts: 35
Hello,
Yes, this is the issue.
But how to configure OFLogger with a configuration file so as to be able to change patterns or whatever when necessary.
Could you please give some hints ? There no info about under the respective FAQ.

Thanks in advance,
Regards,
Kattabomane.


Top
 Profile  
 
PostPosted: Sat, 2017-04-08, 20:40 
Offline
DCMTK Developer

Joined: Tue, 2011-05-03, 14:38
Posts: 1831
Location: Oldenburg, Germany
Looking into the implementation of OFLog::configureFromCommandLine() might help.


Top
 Profile  
 
PostPosted: Sun, 2017-04-09, 15:40 
Offline

Joined: Tue, 2005-02-01, 22:53
Posts: 35
Hello,

Thanks for the hint.

Figured out how to configure via a configuration file :

Code:
 
log4cplus::PropertyConfigurator::doConfigure("D:/Test/log4cplus_configure.ini");
OFLogger logger = OFLog::getLogger("MyFileAppender");
OFLOG_DEBUG(logger, "DCMTK version " << OFFIS_DCMTK_VERSION);


Thanks.

Kattabomane.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group