You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Raghuveer <ra...@infotechsw.com> on 2006/04/20 12:33:41 UTC
log 4 j error in struts 1.2.8
I am using struts1.2.8 with hibernate 3.
I am getting below error.
Is there any solution for this problem ?
----------------------------------------------------
private DailyRollingFileAppender cAeroAppender;
java.util.Calendar cal=java.util.Calendar.getInstance(); // getting
calendar instance
logger = Logger.getLogger(cal.getTime()+"");
strLogLevel=CAeroConstants.getProperty(CAeroConstants.PROPTYPE_CONFIG,CAeroC
onstants.CONFIGPROP_LOG_LEVEL);
logger.setLevel(Level.DEBUG);
}
else if ( strLogLevel.equalsIgnoreCase("DEBUG") ) {
logger.setLevel(Level.DEBUG);
}
else if ( strLogLevel.equalsIgnoreCase("ERROR") ) {
logger.setLevel(Level.ERROR);
}
cAeroAppender = new DailyRollingFileAppender(new
SimpleLayout(),strLogPath+".log","'_'MM-dd-yyyy");
logger.addAppender(cAeroAppender);
-----------------------------
06/04/18 20:50:01 log4j:WARN No appenders could be found for logger
(org.apache.struts.util.PropertyMessageResource
s).
06/04/18 20:50:01 log4j:WARN Please initialize the log4j system properly.
---------------------------------
Raghu
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: log 4 j error in struts 1.2.8 with hibernate
Posted by James Stauffer <st...@gmail.com>.
I would suggest allowing it to be loaded automatically by moving it to
WEB-INF/classes/log4j.properties
On 4/21/06, Raghuveer <ra...@infotechsw.com> wrote:
> Hi
> I have added properties file in WEB-INF/src/com/config directory of my
> application.
> Now i am reading log4j properties in my code below MyAppLog.java
>
> MyAppLog cLog = null; // holds Logger
>
> cLog = new MyAppLog();
> cLog.log("hello....");
>
>
> I am still getting this error
> ---------------------------------------------------
> CODE
>
> try{
>
> _ini_log = new Properties();
>
>
> String log_props = CAeroConstants.CONFIGFILE_LOG;
> //Read log properties file from same location as class file
> InputStream is1 = getClass().getResourceAsStream(log_props);
> _ini_log.load(is1);
> logger = Logger.getLogger(me);
> PropertyConfigurator.configure(_ini_log);
> logger.info("initializing application log..");
>
> if (logger == null) {
> throw new Exception("Error initializing application
> log!!");
> }
>
> }catch(Exception e){
> //Error while loading the properties file
> e.printStackTrace();
> ConsoleAppender cAeroAppender = new
> ConsoleAppender(cAeroLayout);
> logger.addAppender(cAeroAppender);
>
> }
>
>
> -------------------------------------------------------
> ERROR
> 06/04/21 19:14:40 Oracle Application Server Containers for J2EE 10g
> (9.0.4.0.0) initialized
> 06/04/21 19:14:51 log4j:WARN No appenders could be found for logger
> (org.apache.struts.util.PropertyMessageResource
> s).
> 06/04/21 19:14:51 log4j:WARN Please initialize the log4j system properly.
>
>
>
> -----Original Message-----
> From: Jacob Kjome [mailto:hoju@visi.com]
> Sent: Friday, April 21, 2006 10:06 AM
> To: Log4J Users List
> Subject: Re: log 4 j error in struts 1.2.8
>
>
>
> I'm not sure what you are trying to accomplish with resetting the
> levels on the logger, but clearly you have not configured Log4j
> before attempting to log. The simplest thing to do is include a
> Log4j config file (log4j.properties or log4j.xml) in the root of the
> classpath (otherwise known as the "default package") and you are all set.
>
> Jake
>
> At 05:33 AM 4/20/2006, you wrote:
> >
> >
> >
> >I am using struts1.2.8 with hibernate 3.
> >
> >I am getting below error.
> >Is there any solution for this problem ?
> >----------------------------------------------------
> >private DailyRollingFileAppender cAeroAppender;
> > java.util.Calendar cal=java.util.Calendar.getInstance(); // getting
> >calendar instance
> > logger =
> Logger.getLogger(cal.getTime()+"");
> >
> >
>
> >strLogLevel=CAeroConstants.getProperty(CAeroConstants.PROPTYPE_CONFIG,CAero
> C
> >onstants.CONFIGPROP_LOG_LEVEL);
> > logger.setLevel(Level.DEBUG);
> > }
> > else if (
> strLogLevel.equalsIgnoreCase("DEBUG") ) {
> > logger.setLevel(Level.DEBUG);
> > }
> > else if (
> strLogLevel.equalsIgnoreCase("ERROR") ) {
> > logger.setLevel(Level.ERROR);
> > }
> >
> >
> > cAeroAppender = new
> DailyRollingFileAppender(new
> >SimpleLayout(),strLogPath+".log","'_'MM-dd-yyyy");
> > logger.addAppender(cAeroAppender);
> >
> >-----------------------------
> >
> >
> >06/04/18 20:50:01 log4j:WARN No appenders could be found for logger
> >(org.apache.struts.util.PropertyMessageResource
> >s).
> >06/04/18 20:50:01 log4j:WARN Please initialize the log4j system properly.
> >---------------------------------
> >Raghu
> >
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> >For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: log 4 j error in struts 1.2.8 with hibernate
Posted by Raghuveer <ra...@infotechsw.com>.
Hi
I have added properties file in WEB-INF/src/com/config directory of my
application.
Now i am reading log4j properties in my code below MyAppLog.java
MyAppLog cLog = null; // holds Logger
cLog = new MyAppLog();
cLog.log("hello....");
I am still getting this error
---------------------------------------------------
CODE
try{
_ini_log = new Properties();
String log_props = CAeroConstants.CONFIGFILE_LOG;
//Read log properties file from same location as class file
InputStream is1 = getClass().getResourceAsStream(log_props);
_ini_log.load(is1);
logger = Logger.getLogger(me);
PropertyConfigurator.configure(_ini_log);
logger.info("initializing application log..");
if (logger == null) {
throw new Exception("Error initializing application
log!!");
}
}catch(Exception e){
//Error while loading the properties file
e.printStackTrace();
ConsoleAppender cAeroAppender = new
ConsoleAppender(cAeroLayout);
logger.addAppender(cAeroAppender);
}
-------------------------------------------------------
ERROR
06/04/21 19:14:40 Oracle Application Server Containers for J2EE 10g
(9.0.4.0.0) initialized
06/04/21 19:14:51 log4j:WARN No appenders could be found for logger
(org.apache.struts.util.PropertyMessageResource
s).
06/04/21 19:14:51 log4j:WARN Please initialize the log4j system properly.
-----Original Message-----
From: Jacob Kjome [mailto:hoju@visi.com]
Sent: Friday, April 21, 2006 10:06 AM
To: Log4J Users List
Subject: Re: log 4 j error in struts 1.2.8
I'm not sure what you are trying to accomplish with resetting the
levels on the logger, but clearly you have not configured Log4j
before attempting to log. The simplest thing to do is include a
Log4j config file (log4j.properties or log4j.xml) in the root of the
classpath (otherwise known as the "default package") and you are all set.
Jake
At 05:33 AM 4/20/2006, you wrote:
>
>
>
>I am using struts1.2.8 with hibernate 3.
>
>I am getting below error.
>Is there any solution for this problem ?
>----------------------------------------------------
>private DailyRollingFileAppender cAeroAppender;
> java.util.Calendar cal=java.util.Calendar.getInstance(); // getting
>calendar instance
> logger =
Logger.getLogger(cal.getTime()+"");
>
>
>strLogLevel=CAeroConstants.getProperty(CAeroConstants.PROPTYPE_CONFIG,CAero
C
>onstants.CONFIGPROP_LOG_LEVEL);
> logger.setLevel(Level.DEBUG);
> }
> else if (
strLogLevel.equalsIgnoreCase("DEBUG") ) {
> logger.setLevel(Level.DEBUG);
> }
> else if (
strLogLevel.equalsIgnoreCase("ERROR") ) {
> logger.setLevel(Level.ERROR);
> }
>
>
> cAeroAppender = new
DailyRollingFileAppender(new
>SimpleLayout(),strLogPath+".log","'_'MM-dd-yyyy");
> logger.addAppender(cAeroAppender);
>
>-----------------------------
>
>
>06/04/18 20:50:01 log4j:WARN No appenders could be found for logger
>(org.apache.struts.util.PropertyMessageResource
>s).
>06/04/18 20:50:01 log4j:WARN Please initialize the log4j system properly.
>---------------------------------
>Raghu
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: log 4 j error in struts 1.2.8
Posted by Jacob Kjome <ho...@visi.com>.
I'm not sure what you are trying to accomplish with resetting the
levels on the logger, but clearly you have not configured Log4j
before attempting to log. The simplest thing to do is include a
Log4j config file (log4j.properties or log4j.xml) in the root of the
classpath (otherwise known as the "default package") and you are all set.
Jake
At 05:33 AM 4/20/2006, you wrote:
>
>
>
>I am using struts1.2.8 with hibernate 3.
>
>I am getting below error.
>Is there any solution for this problem ?
>----------------------------------------------------
>private DailyRollingFileAppender cAeroAppender;
> java.util.Calendar cal=java.util.Calendar.getInstance(); // getting
>calendar instance
> logger = Logger.getLogger(cal.getTime()+"");
>
>
>strLogLevel=CAeroConstants.getProperty(CAeroConstants.PROPTYPE_CONFIG,CAeroC
>onstants.CONFIGPROP_LOG_LEVEL);
> logger.setLevel(Level.DEBUG);
> }
> else if (
strLogLevel.equalsIgnoreCase("DEBUG") ) {
> logger.setLevel(Level.DEBUG);
> }
> else if (
strLogLevel.equalsIgnoreCase("ERROR") ) {
> logger.setLevel(Level.ERROR);
> }
>
>
> cAeroAppender = new
DailyRollingFileAppender(new
>SimpleLayout(),strLogPath+".log","'_'MM-dd-yyyy");
> logger.addAppender(cAeroAppender);
>
>-----------------------------
>
>
>06/04/18 20:50:01 log4j:WARN No appenders could be found for logger
>(org.apache.struts.util.PropertyMessageResource
>s).
>06/04/18 20:50:01 log4j:WARN Please initialize the log4j system properly.
>---------------------------------
>Raghu
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org