You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by ca...@encopim.com on 2009/11/24 13:05:43 UTC
Problems executing application with log4cxx
Hello,
First, sorry for my english.
I'm new with log4cxx and I have problems. When I use
PropertyConfiguration into my code, application crashes, but if I use
BasicConfiguration, works fine.
#include <log4cxx/logger.h>
#include <log4cxx/propertyconfigurator.h>
#include "Sistema/SistemaRTEST4Cilindres.h"
using namespace log4cxx;
LoggerPtr logger(Logger::getLogger("main"));
int main(int argc, char *argv[]){
SistemaRTEST4Cilindres *sistema=NULL;
PropertyConfigurator::configure("/etc/rtai/log/log4cxx.properties");
LOG4CXX_FATAL(logger, '\n');
LOG4CXX_INFO(logger, "Programa main(): Cargamos el sistema");
....
/etc/rtai/log/log4cxx.properties
# Sample ResourceBundle properties file
log4j.rootLogger=INFO, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=/var/log/rtaid.log
log4j.appender.R.MaxFileSize=200KB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d [%t] %-3p (%F:%L) - %m%n
log4j.logger.Cicle=WARN
log4j.logger.DadesFase=WARN
log4j.logger.Fase=WARN
log4j.logger.Modul=WARN
log4j.logger.Sistema=WARN
#log4j.logger.Sistema.RTEST=WARN
log4j.logger.Transicions=WARN
#log4j.logger.ServidorDades=WARN
My host OS is Debian, someone have any idea??
Thank you.
--
Carlos Jiménez
ENCOPIM S.L.
C/. del Parc 5 (nau 13), P.I. Els Pinetons
E-08291 RIPOLLET (Barcelona)
Tel: (+34) 935 94 23 47
Fax: (+34) 935 94 64 15
==========================================================
La información contenida en la presente transmisión es confidencial y su
uso únicamente está permitido a su(s) destinatario(s). Si Ud. no es la
persona destinataria de la presente transmisión, rogamos nos lo
comunique de manera inmediata por teléfono (+34 935 942 347) y destruya
cualquier copia de la misma (tanto digitales como en papel).
The information contained in this transmission is confidential and is
intended only for the use of the addressee(s). If you are not the
designated recipient of this transmission, please advise us immediately
by telephone (+34 935 942 347) and destroy any copies (digital and
paper).
==========================================================
Re: Problems executing application with log4cxx
Posted by ca...@encopim.com.
The problem seems to be the size of log file, but now I have another problem.
If I want to use logger Sistema.RTEST, it doesn't work, but if I use
rootLooger, works fine.
SistemaRTEST4Cilindres.cpp
#include "SistemaRTEST4Cilindres.h"
LoggerPtr loggerSistemaRTEST(Logger::getLogger("Sistema.RTEST"));
//LoggerPtr loggerSistemaRTEST(Logger::getRootLogger());
void SistemaRTEST4Cilindres::obrirTargetes(){
LOG4CXX_INFO(loggerSistemaRTEST, "Abrimos los dispositivos para
las targetas que tenemos");
// EDITAR:
targetes[iE6229_1]->open("/dev/comedi0");
}
....
The only difference with other examples is that this code is inside a
directory.
main.cpp
Sistema/SistemaRTEST4Cilindres.h
Sistema/SistemaRTEST4Cilindres.cpp
I've tested in the main directoy and that worked correctly. That's
what I'm doing wrong?
Thank you
Quoting carlos_jimenez@encopim.com:
> Hello,
>
> First, sorry for my english.
>
> I'm new with log4cxx and I have problems. When I use
> PropertyConfiguration into my code, application crashes, but if I use
> BasicConfiguration, works fine.
>
> #include <log4cxx/logger.h>
> #include <log4cxx/propertyconfigurator.h>
> #include "Sistema/SistemaRTEST4Cilindres.h"
>
> using namespace log4cxx;
>
> LoggerPtr logger(Logger::getLogger("main"));
>
> int main(int argc, char *argv[]){
> SistemaRTEST4Cilindres *sistema=NULL;
>
> PropertyConfigurator::configure("/etc/rtai/log/log4cxx.properties");
>
> LOG4CXX_FATAL(logger, '\n');
> LOG4CXX_INFO(logger, "Programa main(): Cargamos el sistema");
>
> ....
>
>
> /etc/rtai/log/log4cxx.properties
>
> # Sample ResourceBundle properties file
> log4j.rootLogger=INFO, R
>
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=/var/log/rtaid.log
>
> log4j.appender.R.MaxFileSize=200KB
> log4j.appender.R.MaxBackupIndex=10
>
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%d [%t] %-3p (%F:%L) - %m%n
>
> log4j.logger.Cicle=WARN
> log4j.logger.DadesFase=WARN
> log4j.logger.Fase=WARN
> log4j.logger.Modul=WARN
> log4j.logger.Sistema=WARN
> #log4j.logger.Sistema.RTEST=WARN
> log4j.logger.Transicions=WARN
> #log4j.logger.ServidorDades=WARN
>
>
> My host OS is Debian, someone have any idea??
>
> Thank you.
>
>
> --
> Carlos Jiménez
>
> ENCOPIM S.L.
> C/. del Parc 5 (nau 13), P.I. Els Pinetons
> E-08291 RIPOLLET (Barcelona)
> Tel: (+34) 935 94 23 47
> Fax: (+34) 935 94 64 15
>
> ==========================================================
> La información contenida en la presente transmisión es confidencial y su
> uso únicamente está permitido a su(s) destinatario(s). Si Ud. no es la
> persona destinataria de la presente transmisión, rogamos nos lo
> comunique de manera inmediata por teléfono (+34 935 942 347) y destruya
> cualquier copia de la misma (tanto digitales como en papel).
>
> The information contained in this transmission is confidential and is
> intended only for the use of the addressee(s). If you are not the
> designated recipient of this transmission, please advise us immediately
> by telephone (+34 935 942 347) and destroy any copies (digital and
> paper).
> ==========================================================
--
Carlos Jiménez
ENCOPIM S.L.
C/. del Parc 5 (nau 13), P.I. Els Pinetons
E-08291 RIPOLLET (Barcelona)
Tel: (+34) 935 94 23 47
Fax: (+34) 935 94 64 15
==========================================================
La información contenida en la presente transmisión es confidencial y su
uso únicamente está permitido a su(s) destinatario(s). Si Ud. no es la
persona destinataria de la presente transmisión, rogamos nos lo
comunique de manera inmediata por teléfono (+34 935 942 347) y destruya
cualquier copia de la misma (tanto digitales como en papel).
The information contained in this transmission is confidential and is
intended only for the use of the addressee(s). If you are not the
designated recipient of this transmission, please advise us immediately
by telephone (+34 935 942 347) and destroy any copies (digital and
paper).
==========================================================