Newsgroup: it.comp.java
Titolo: [Log4j] - caricamento parametri


http://csvtosql.sf.net

 
Qualcosa del genere (non l'ho provato con log4j)?:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"[
<!ENTITY file_esterno SYSTEM "file4log4j.xml">]>
<log4j:configuration xmlns:log4j='
http://jakarta.apache.org/log4j/
'>
<appender name="UCF_Exception" class="org.apache.log4j.RollingFileAppender">
&file_esterno;
<param name="Append" value="false"/>
<param name="MaxFileSize" value="1000KB"/>
<param name="MaxBackupIndex" value="2"/>
<layout class="org.apache.log4j.xml.XMLLayout">
<param name="LocationInfo" value="true"/>
</layout>
</appender>
<log4j.logger.UCFExceptionLogger>
<level value ="debug"/>
<appender-ref ref="UCF_Exception" />
</log4j.logger.UCFExceptionLogger>
</log4j:configuration>
file4log4j.xml:
<param name="File" value="prova"/>
--
Ciao
Marco

 <param name="File" value="prova"/>
non ho capito. :)


 
.
+-log4j.dtd
+-log4j.xml
+-file4log4j.xml
se apro log4j.xml con explorer vedo a video:
<?xml version="1.0" encoding="UTF-8" ?>
   <!DOCTYPE log4j:configuration (View Source for full doctype...)>
- <log4j:configuration xmlns:log4j="
http://jakarta.apache.org/log4j/
" 
threshold="null" debug="null">
- <appender name="UCF_Exception" 
class="org.apache.log4j.RollingFileAppender">
   <param name="File" value="prova" />
   <param name="Append" value="false" />
   <param name="MaxFileSize" value="1000KB" />
   <param name="MaxBackupIndex" value="2" />
- <layout class="org.apache.log4j.xml.XMLLayout">
   <param name="LocationInfo" value="true" />
   </layout>
   </appender>
- <log4j.logger.UCFExceptionLogger>
   <level value="debug" />
   <appender-ref ref="UCF_Exception" />
   </log4j.logger.UCFExceptionLogger>
   </log4j:configuration>
"Referencing External Entities"
http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/sax/5c_dtd.html
--
Ciao
Marco

 
.
+-log4j.dtd
+-log4j.xml
+-file4log4j.xml
se apro log4j.xml con internete explorer vedo:
<?xml version="1.0" encoding="UTF-8" ?>
   <!DOCTYPE log4j:configuration (View Source for full doctype...)>
- <log4j:configuration xmlns:log4j="
http://jakarta.apache.org/log4j/
" 
threshold="null" debug="null">
- <appender name="UCF_Exception" 
class="org.apache.log4j.RollingFileAppender">
   <param name="File" value="prova" />
   <param name="Append" value="false" />
   <param name="MaxFileSize" value="1000KB" />
   <param name="MaxBackupIndex" value="2" />
- <layout class="org.apache.log4j.xml.XMLLayout">
   <param name="LocationInfo" value="true" />
   </layout>
   </appender>
- <log4j.logger.UCFExceptionLogger>
   <level value="debug" />
   <appender-ref ref="UCF_Exception" />
   </log4j.logger.UCFExceptionLogger>
   </log4j:configuration>
"Referencing External Entities"


:( 
non lo digerisce e se ne esce con un errore strano, sotto il trace
non capisco perchč : "unknown protocol: dummy"
log4j:ERROR Could not parse input source [org.xml.sax.InputSource@e4bb3c].
java.net.MalformedURLException: unknown protocol: dummy
        at java.net.URL.<init>(URL.java:574)
        at java.net.URL.<init>(URL.java:464)
        at java.net.URL.<init>(URL.java:413)
        at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEntityReference(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
        at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:674)
        at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:625)
        at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:611)
        at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:468)
        at org.apache.log4j.LogManager.<clinit>(LogManager.java:122)
        at org.apache.log4j.Logger.getLogger(Logger.java:103)
        at org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:102)
        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 org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:370)
        at org.apache.catalina.core.ContainerBase.getLogger(ContainerBase.java:380)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:995)
        at org.apache.catalina.core.StandardWrapper.start(StandardWrapper.java:1605)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
        at org.apache.catalina.core.StandardContext.addChild(StandardContext.java:1884)
        at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:890)
        at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:192)
        at org.apache.tomcat.util.digester.Rule.end(Rule.java:228)
        at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1057)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1561)
        at org.apache.catalina.startup.ContextConfig.processDefaultWebConfig(ContextConfig.java:621)
        at org.apache.catalina.startup.ContextConfig.defaultWebConfig(ContextConfig.java:573)
        at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:958)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:249)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4020)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:590)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:493)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1183)
        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.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
        at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
        at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
        at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1377)
        at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:814)
        at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:343)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:168)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:595)
log4j:WARN No appenders could be found for logger (org.apache.catalina.session.ManagerBase).
log4j:WARN Please initialize the log4j system properly.
