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 Jacob Kjome <ho...@visi.com> on 2007/02/16 07:18:39 UTC

Re: Throwing IllegalArgumentException when using RollingFileAppender

I wouldn't be mixing Log4j 1.1.3 and 1.2.13.  Why are you using two 
different versions?  Pick one (the newer one) and call it a day.  In 
fact, download 1.2.14 just to make sure you are up to date with the 
latest and greatest.

Jake

At 08:31 PM 2/13/2007, you wrote:
>Hi,
>
>Our product is having 4 different applications and using two 
>different version of log4j. (1.1.3 and 1.2.13). When I m using 
>rollingfile Appender in one of the application which uses 
>log4j(1.2.13), It is throwing the following exception.
>
>Tomcat version : 5.5
>
>log4j:WARN Failed to set property [file] to value "example.log".
>java.lang.IllegalArgumentException: object is not an instance of 
>declaring class
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:585)
>     at 
> org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:205)
>     at 
> org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:164)
>     at 
> org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:129)
>     at 
> org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:96)
>     at 
> org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:654)
>     at 
> org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:612)
>     at 
> org.apache.log4j.PropertyConfigurator.parseCatsAndRenderers(PropertyConfigurator.java:533)
>     at 
> org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:417)
>     at 
> org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:316)
>     at 
> org.apache.log4j.PropertyWatchdog.doOnChange(PropertyConfigurator.java:682)
>     at 
> org.apache.log4j.helpers.FileWatchdog.checkAndConfigure(FileWatchdog.java:88)
>     at org.apache.log4j.helpers.FileWatchdog.<init>(FileWatchdog.java:57)
>     at 
> org.apache.log4j.PropertyWatchdog.<init>(PropertyConfigurator.java:674)
>     at 
> org.apache.log4j.PropertyConfigurator.configureAndWatch(PropertyConfigurator.java:382)
>     at com.liferay.portal.events.InitAction.run(InitAction.java:147)
>     at 
> com.liferay.portal.events.EventsProcessor._process(EventsProcessor.java:144)
>     at 
> com.liferay.portal.events.EventsProcessor.process(EventsProcessor.java:73)
>     at com.liferay.portal.util.InitUtil.init(InitUtil.java:38)
>     at com.liferay.portal.util.PropsUtil.<clinit>(PropsUtil.java:23)
>     at 
> com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter.<clinit>(LayoutCacheFilter.java:448)
>     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>     at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>     at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>     at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>     at java.lang.Class.newInstance0(Class.java:350)
>     at java.lang.Class.newInstance(Class.java:303)
>     at 
> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:210)
>     at 
> org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:304)
>     at 
> org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:77)
>     at 
> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3600)
>     at 
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4193)
>     at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
>     at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
>     at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
>     at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
>     at 
> org.apache.catalina.core.StandardService.start(StandardService.java:450)
>     at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
>     at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:585)
>     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
>     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
>log4j:WARN File option not set for appender [portallogger].
>log4j:WARN Are you using FileAppender instead of ConsoleAppender?
>Property file successfully loaded
>
>
>Any idea how to fix this issue ???
>
>1. I have attached the property file which I had in my application.
>2. JRE Version :1.5.0_10 and 1.4.2_12   OS:Win2003
>3. location of log4j with version 1.2.13 : 
>C:\Test\MDC\tomcat\webapps\cwportal\WEB-INF\lib
>Test is the directory where we deployed tomcat
>cwportal is our  webapp name
>
>location of log4j with version 1.1.3 : C:\Test\objects\log4j\1.1.3
>This is the log4j which is loaded at the start of tomcat.
>
>4. catalina.properties is placed under C:\Test\MDC\tomcat\conf\ and 
>log4j.properties is placed under 
>C:\Test\MDC\tomcat\webapps\cwportal\WEB-INF\classes
>
>
>
>
>
>
>Note : Samething is working fine when I use FileAppenders.
>
>Regards
>Prathib Kumar
>
>
>Here's a new way to find what you're looking for - 
><http://us.rd.yahoo.com/mail/in/yanswers/*http://in.answers.yahoo.com/>Yahoo! 
>Answers
>---------------------------------------------------------------------
>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: Throwing IllegalArgumentException when using RollingFileAppender

Posted by Jacob Kjome <ho...@visi.com>.
Quoting Prathib Kumar <pr...@yahoo.co.in>:

> Hi Jake,
>
> I dont have a control on other application to do that.  Because they have not
> used the  anything in the latest log4j. But in my application i used
> LogFactory which is available in 1.2.13 and not in 1.1.13. So they are not
> ready to upgrade with me.
>

What do you mean you use "LogFactory"?  Are you just getting loggers?   The
pattern is...

Logger logger = Logger.getLogger("loggername");

Or did you write a custom appender or some other extension of Log4j?

As far as the error goes, it's unusual that your webapp would be having
difficulty.  Child-first classloading behavior should keep the Log4j versions
isolated.  I can think of two possible issues...

1.  You are running under some custom configuration of Tomcat where Parent-First
classloading behavior is used.  This would be common if Tomcat is used as an
embedded servlet container, such as under JBoss.  Otherwise, it would be
unusual as the scripts and config that Tomcat ships with in standalone mode
enable Child-First classloading behavior.

2.  The Log4j-1.2.xx instance in your webapp is picking up the logging
properties of Log4j-1.1.3.  It's possible that the 1.1.3 config is not
compatible with the 1.2.x config.  The remedy here is to put log4j.properties
or log4j.xml in WEB-INF/classes that is compatible with Log4j-1.2.xx


Jake

>
> Regards
> Prathib Kumar
>
> Jacob Kjome <ho...@visi.com> wrote:
> I wouldn't be mixing Log4j 1.1.3 and 1.2.13.  Why are you using two
> different versions?  Pick one (the newer one) and call it a day.  In
> fact, download 1.2.14 just to make sure you are up to date with the
> latest and greatest.
>
> Jake
>
> At 08:31 PM 2/13/2007, you wrote:
> >Hi,
> >
> >Our product is having 4 different applications and using two
> >different version of log4j. (1.1.3 and 1.2.13). When I m using
> >rollingfile Appender in one of the application which uses
> >log4j(1.2.13), It is throwing the following exception.
> >
> >Tomcat version : 5.5
> >
> >log4j:WARN Failed to set property [file] to value "example.log".
> >java.lang.IllegalArgumentException: object is not an instance of
> >declaring class
> >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >     at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >     at
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >     at java.lang.reflect.Method.invoke(Method.java:585)
> >     at
> > org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:205)
> >     at
> > org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:164)
> >     at
> >
> org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:129)
> >     at
> >
> org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:96)
> >     at
> >
>
org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:654)
> >     at
> >
>
org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:612)
> >     at
> >
>
org.apache.log4j.PropertyConfigurator.parseCatsAndRenderers(PropertyConfigurator.java:533)
> >     at
> >
>
org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:417)
> >     at
> >
>
org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:316)
> >     at
> > org.apache.log4j.PropertyWatchdog.doOnChange(PropertyConfigurator.java:682)
> >     at
> >
> org.apache.log4j.helpers.FileWatchdog.checkAndConfigure(FileWatchdog.java:88)
> >     at org.apache.log4j.helpers.FileWatchdog.(FileWatchdog.java:57)
> >     at
> > org.apache.log4j.PropertyWatchdog.(PropertyConfigurator.java:674)
> >     at
> >
>
org.apache.log4j.PropertyConfigurator.configureAndWatch(PropertyConfigurator.java:382)
> >     at com.liferay.portal.events.InitAction.run(InitAction.java:147)
> >     at
> >
> com.liferay.portal.events.EventsProcessor._process(EventsProcessor.java:144)
> >     at
> > com.liferay.portal.events.EventsProcessor.process(EventsProcessor.java:73)
> >     at com.liferay.portal.util.InitUtil.init(InitUtil.java:38)
> >     at com.liferay.portal.util.PropsUtil.(PropsUtil.java:23)
> >     at
> >
>
com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter.(LayoutCacheFilter.java:448)
> >     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
> >     at
> >
>
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> >     at
> >
>
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> >     at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> >     at java.lang.Class.newInstance0(Class.java:350)
> >     at java.lang.Class.newInstance(Class.java:303)
> >     at
> >
>
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:210)
> >     at
> >
>
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:304)
> >     at
> >
>
org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:77)
> >     at
> >
>
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3600)
> >     at
> > org.apache.catalina.core.StandardContext.start(StandardContext.java:4193)
> >     at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
> >     at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
> >     at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
> >     at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
> >     at
> > org.apache.catalina.core.StandardService.start(StandardService.java:450)
> >     at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
> >     at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
> >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >     at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >     at
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >     at java.lang.reflect.Method.invoke(Method.java:585)
> >     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
> >     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
> >log4j:WARN File option not set for appender [portallogger].
> >log4j:WARN Are you using FileAppender instead of ConsoleAppender?
> >Property file successfully loaded
> >
> >
> >Any idea how to fix this issue ???
> >
> >1. I have attached the property file which I had in my application.
> >2. JRE Version :1.5.0_10 and 1.4.2_12   OS:Win2003
> >3. location of log4j with version 1.2.13 :
> >C:\Test\MDC\tomcat\webapps\cwportal\WEB-INF\lib
> >Test is the directory where we deployed tomcat
> >cwportal is our  webapp name
> >
> >location of log4j with version 1.1.3 : C:\Test\objects\log4j\1.1.3
> >This is the log4j which is loaded at the start of tomcat.
> >
> >4. catalina.properties is placed under C:\Test\MDC\tomcat\conf\ and
> >log4j.properties is placed under
> >C:\Test\MDC\tomcat\webapps\cwportal\WEB-INF\classes
> >
> >
> >
> >
> >
> >
> >Note : Samething is working fine when I use FileAppenders.
> >
> >Regards
> >Prathib Kumar
> >
> >
> >Here's a new way to find what you're looking for -
> >Yahoo!
> >Answers
> >---------------------------------------------------------------------
> >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
>
>
>
>
> ---------------------------------
>  Here’s a new way to find what you're looking for - Yahoo! Answers




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Throwing IllegalArgumentException when using RollingFileAppender

Posted by Prathib Kumar <pr...@yahoo.co.in>.
Hi Jake,

I dont have a control on other application to do that.  Because they have not used the  anything in the latest log4j. But in my application i used LogFactory which is available in 1.2.13 and not in 1.1.13. So they are not ready to upgrade with me.


Regards
Prathib Kumar

Jacob Kjome <ho...@visi.com> wrote: 
I wouldn't be mixing Log4j 1.1.3 and 1.2.13.  Why are you using two 
different versions?  Pick one (the newer one) and call it a day.  In 
fact, download 1.2.14 just to make sure you are up to date with the 
latest and greatest.

Jake

At 08:31 PM 2/13/2007, you wrote:
>Hi,
>
>Our product is having 4 different applications and using two 
>different version of log4j. (1.1.3 and 1.2.13). When I m using 
>rollingfile Appender in one of the application which uses 
>log4j(1.2.13), It is throwing the following exception.
>
>Tomcat version : 5.5
>
>log4j:WARN Failed to set property [file] to value "example.log".
>java.lang.IllegalArgumentException: object is not an instance of 
>declaring class
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:585)
>     at 
> org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:205)
>     at 
> org.apache.log4j.config.PropertySetter.setProperty(PropertySetter.java:164)
>     at 
> org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:129)
>     at 
> org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:96)
>     at 
> org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:654)
>     at 
> org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:612)
>     at 
> org.apache.log4j.PropertyConfigurator.parseCatsAndRenderers(PropertyConfigurator.java:533)
>     at 
> org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:417)
>     at 
> org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:316)
>     at 
> org.apache.log4j.PropertyWatchdog.doOnChange(PropertyConfigurator.java:682)
>     at 
> org.apache.log4j.helpers.FileWatchdog.checkAndConfigure(FileWatchdog.java:88)
>     at org.apache.log4j.helpers.FileWatchdog.(FileWatchdog.java:57)
>     at 
> org.apache.log4j.PropertyWatchdog.(PropertyConfigurator.java:674)
>     at 
> org.apache.log4j.PropertyConfigurator.configureAndWatch(PropertyConfigurator.java:382)
>     at com.liferay.portal.events.InitAction.run(InitAction.java:147)
>     at 
> com.liferay.portal.events.EventsProcessor._process(EventsProcessor.java:144)
>     at 
> com.liferay.portal.events.EventsProcessor.process(EventsProcessor.java:73)
>     at com.liferay.portal.util.InitUtil.init(InitUtil.java:38)
>     at com.liferay.portal.util.PropsUtil.(PropsUtil.java:23)
>     at 
> com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter.(LayoutCacheFilter.java:448)
>     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>     at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>     at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>     at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>     at java.lang.Class.newInstance0(Class.java:350)
>     at java.lang.Class.newInstance(Class.java:303)
>     at 
> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:210)
>     at 
> org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:304)
>     at 
> org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:77)
>     at 
> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3600)
>     at 
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4193)
>     at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
>     at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
>     at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
>     at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
>     at 
> org.apache.catalina.core.StandardService.start(StandardService.java:450)
>     at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
>     at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:585)
>     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
>     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
>log4j:WARN File option not set for appender [portallogger].
>log4j:WARN Are you using FileAppender instead of ConsoleAppender?
>Property file successfully loaded
>
>
>Any idea how to fix this issue ???
>
>1. I have attached the property file which I had in my application.
>2. JRE Version :1.5.0_10 and 1.4.2_12   OS:Win2003
>3. location of log4j with version 1.2.13 : 
>C:\Test\MDC\tomcat\webapps\cwportal\WEB-INF\lib
>Test is the directory where we deployed tomcat
>cwportal is our  webapp name
>
>location of log4j with version 1.1.3 : C:\Test\objects\log4j\1.1.3
>This is the log4j which is loaded at the start of tomcat.
>
>4. catalina.properties is placed under C:\Test\MDC\tomcat\conf\ and 
>log4j.properties is placed under 
>C:\Test\MDC\tomcat\webapps\cwportal\WEB-INF\classes
>
>
>
>
>
>
>Note : Samething is working fine when I use FileAppenders.
>
>Regards
>Prathib Kumar
>
>
>Here's a new way to find what you're looking for - 
>Yahoo! 
>Answers
>---------------------------------------------------------------------
>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



 				
---------------------------------
 Here’s a new way to find what you're looking for - Yahoo! Answers