Use org.apache.catalina.FileLogger

Hi All,
Does any1 know of a neat way to implement the org.apache.catalina.logger.FileLogger class in a JSP ?
I have referred to a number of sites and all I got was to configure the server.xml file's Context for the org.apache.catalina.logger.FileLogger class.
But that's not what I want.
What I want is to be able to implement the logging thru JSP code so that I can write my own errors in the log file.
Any suggessions ??
Thanx.
Sherbir

Hi,
you must to try whit this
in the web.xml
<init-param>
     <param-name>FileLog</param-name>
<param-value>/log/logfile.log</param-value>
</init-param>
<init-param>
     <param-name>log4j-init-conf</param-name>
<param-value>log4j.properties</param-value>
</init-param>
in your class
String directory = this.getServlet().getInitParameter("FileLog");
System.out.print(directory);
System.setProperty("log.directory", directory);
String prefix = this.getServlet().getServletContext().getRealPath("/");
String file = this.getServlet().getInitParameter("log4j-init-conf");
System.out.println(prefix+file);
if(file == null|| file.trim().length()==0 ||(new File(prefix+file).isFile())){
System.out.println("ERROR: no se puede leer el archivo ");

Similar Messages

  • Container org.apache.catalina.core.ContainerBase has not been started

    Hi I'm integrated Tomcat 5 with Apache 2.0 using mod_jk on Fedora core 7 server. My problem is
    i cannot deploy my web application residing on /var/www/webapps/scienceph folder
    which has my index.jsp file.
    here is my code:
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" errorPage="" %>
    <html>
    <head>
    <title>science.ph</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <%java.util.Date today = new java.util.Date();
    out.println("Today's date is: "+today);
    %>
    scienceph ..
    </body>
    </html>when i started tomcat i got the following exceptions in my log file..
    Apr 23, 2008 5:28:03 PM org.apache.catalina.core.StandardContext start
    SEVERE: Error in resourceStart()
    Apr 23, 2008 5:28:03 PM org.apache.catalina.core.StandardContext start
    SEVERE: Error getConfigured
    Apr 23, 2008 5:28:03 PM org.apache.catalina.core.StandardContext start
    SEVERE: Context [/conf] startup failed due to previous errors
    Apr 23, 2008 5:28:03 PM org.apache.catalina.core.StandardContext stop
    INFO: Container org.apache.catalina.core.ContainerBase.[Integration].[www.science.ph].[/conf] has not been started
    Apr 23, 2008 5:28:03 PM org.apache.commons.modeler.Registry registerComponent
    SEVERE: Error registering Integration:type=Cache,host=www.science.ph,path=/server
    sun.misc.InvalidJarIndexException: Invalid index
            at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:854)
            at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:762)
            at sun.misc.URLClassPath$JarLoader.findResource(URLClassPath.java:732)
            at sun.misc.URLClassPath.findResource(URLClassPath.java:145)
            at java.net.URLClassLoader$2.run(URLClassLoader.java:362)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findResource(URLClassLoader.java:359)
            at java.lang.ClassLoader.getResource(ClassLoader.java:977)
            at org.apache.commons.modeler.Registry.loadDescriptors(Registry.java:867)
            at org.apache.commons.modeler.Registry.findDescriptor(Registry.java:960)
            at org.apache.commons.modeler.Registry.findManagedBean(Registry.java:665)
            at org.apache.commons.modeler.Registry.findManagedBean(Registry.java:1014)
            at org.apache.commons.modeler.Registry.registerComponent(Registry.java:831)
            at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3869)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:4024)
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
            at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
            at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
            at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
            at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
            at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
            at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
            at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
            at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
            at org.apache.catalina.core.StandardService.start(StandardService.java:448)
            at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
            at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)here is my server.xml
    <Server port="8005" shutdown="" debug="0">
      <Listener className="org.apache.jk.config.ApacheConfig" modJk="/etc/httpd/modules/mod_jk.so"/>
       <Service name="Tomcat-Apache">
         <Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
            address="www.science.ph" port="8009" minProcessors="5" maxProcessors="75"
            enableLookups="false" protocol="AJP/1.3" acceptCount="10" debug="0" maxPostSize="4097152"/>
         <Engine name="Integration" debug="0" defaultHost="www.science.ph">
    <!--        <Logger className="org.apache.catalina.logger.FileLogger"
                    prefix="catalina_log." suffix=".txt"
                    timestamp="true"/> -->
            <Host name="www.science.ph" debug="0" unpackWARS="true" appBase="" autodeploy="true"
                    xmlValidation="false" xmlNameSpaceAware="false">
         <Listener className="org.apache.jk.config.ApacheConfig" append="true" forwardAll="false" modJk="/etc/httpd/modules/mod_jk.so"/>
                <Context path="" docBase="/var/www/webapps/scienceph"  debug="0" reloadable="true">
    <!--              <Logger className="org.apache.catalina.logger.FileLogger"
                    prefix="localhost_DBTest_log." suffix=".txt"
                    timestamp="true"/> -->
                   </Context>
            </Host>
        </Engine>
      </Service>
    </Server>how can i solve this problem.. I'm not seeing my application in the browser.. please help me.. thanks in advance for your help..

    I already solved this problem.. for others who might also encounter this problem..
    just uninstall tomcat from FC7 and install a fresh copy from tomcat website
    tomcat version 5.0.26 works for me. hope this help..
    God bless..
    <img class="emoticon" src="images/emoticons/wink.gif" border="0" alt="" />

  • Newbie question: taskdef class org.apache.catalina.ant.DeployTask error

    Hi,
    I am trying to run one of the examples in the JWS tutorial, but everytime I go "ant build" it throws the following error
    <stuff_up_front>/jaxrpc/common/targets.xml:30: taskdef class org.apache.catalina.ant.DeployTask cannot be found
    As far as I know I have all the necessary path and environmental variable set. Only thing I can think of is that I choose not to install the Tomcat that comes bundled with the JWSDP package since I already had tomcat server running on my machine. But my Catalina_Home has been set from a long time and it works with other applications. So I really not sure what I am suppose to do. Help would be very welcomed. Thansk you.

    Please dis regard I just now noticed the dates on this thread. (I sure hope you have gotten it working by now.)
    I did get these examples running. The fact that I had several versions of Tomcat installed by IDE's I think alot of my env.vars where not pointing to the proper place. I ended up just using all the stuff that came with the jwsdp(server and likes). maybe later once I get a greater understanding I can do better. BUT I AM A BIT SLOW. Thanks all.
    If you every reply to me type slow so i can keep up.

  • Taskdef class org.apache.catalina.ant.deploytask cannot be found

    I am trying some examples of webserives. These examples are required to be run by Ant tool. Now I intall JWSDP-2.0 and tomcat50-jwsdp separately. And set up enviroment variable. now run Ant to compile the program, displays an error-----D:\CIS631\JWSNutshell\examples\chapter1\amazon\buildsetup.xml:31:taskdef class org.apache.catalina.ant.deploytask cannot be found. I have no any idea for this error. Who could tell me how to solve it? Thanks for your help!

    >
    BUILD FAILED
    ........jwsdp-1.1/tutorial/examples/jaxrpc/common/targe
    s.xml:4: taskdef class
    org.apache.catalina.ant.DeployTask cannot be foundFrom the "Getting Started" section of the tutorial, you need to add <JWSDP_HOME>/jakarta-ant-1.5.1/bin to the front of your PATH. This ensures that you're using the correct version of ant for the example.
    Cheers,
    Bobby Bissett

  • Org.apache.catalina.startup.Bootstrap

    On our XServe with MacOS X Server 10.6.8 there appears in the dock 'org.apache.catalina.startup.Bootstrap'. This prevents the system from rebooting. How can we remove 'org.apache.catalina.startup.Bootstrap'?

    Catalina is part of Apache Tomcat, which is a web services environment.  That tool is not part of the default contents of the Dock on OS X Server 10.6, so it's been added.  If you don't want it in the Dock.app, then drag it off the Dock.app.   Might also want to see if Tomcat is being automatically launched during bootstrap, if you don't want that.  Usual launch would be via launchd or maybe via a login item or via a web-related start-up. 
    Which implies there's something else going on here, or something else that's concerning you related to the OS X Server environment.  Could you elaborate a little more on what's happening or the specific text of any diagnostics you're receiving? 
    Now if Tomcat is running and you're trying to reboot, for instance, then you'll probably want to shut down Tomcat first, or rework the shutdown to perform that shutdown automatically. 
    If you're intending to run Apache Tomcat and don't want that icon to appear in the Dock, then you'll want to use a command-line editor or TextWrangler text editor (do not use a GUI text editor, Office, nor the TextEdit tool, to edit this file, as these will convert the file to a format that won't be readable by the Unix environment) the catalina.properties file, and add the following configuration setting:
    java.awt.headless=true
    On a local 10.6 OS X Server box, here's the path to that file:
    $ locate catalina.properties
    /Library/Tomcat/conf/catalina.properties
    $

  • Webaccess on SLES10: ERROR org.apache.catalina.startup.HostC

    Hi,
    How to solve:
    ERROR org.apache.catalina.startup.HostConfig - Error deploying web application directory gw
    java.lang.UnsupportedClassVersionError: com/novell/webaccess/WebAccessServlet (Unsupported major.minor version 49.0)
    While java -version shows:
    java version "1.5.0"
    Java(TM) 2 Runtime Environment, Standard Edition (build pxi32dev-20061002a (SR3) )
    IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Linux x86-32 j9vmxi3223-20061001 (JIT enabled)
    J9VM - 20060915_08260_lHdSMR
    JIT - 20060908_1811_r8
    GC - 20060906_AA)
    JCL - 20061002
    And the manual says:
    OES 2 Linux / SLES 10
    Apache 2.2 plus:
    Tomcat 5 or later
    Tomcat 5 is included with the Linux operating system.
    JRE 5 or later
    ModProxy Module
    And rpm -qa | grep java
    java-1_5_0-ibm-1.5.0_sr3-13.10
    With regards,
    Alex

    On 1/30/2012 1:56 AM, twslex3 wrote:
    >
    > Hi,
    >
    > How to solve:
    >
    > ERROR org.apache.catalina.startup.HostConfig - Error deploying web
    > application directory gw
    > java.lang.UnsupportedClassVersionError:
    > com/novell/webaccess/WebAccessServlet (Unsupported major.minor version
    > 49.0)
    >
    > While java -version shows:
    > java version "1.5.0"
    > Java(TM) 2 Runtime Environment, Standard Edition (build
    > pxi32dev-20061002a (SR3) )
    > IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Linux x86-32
    > j9vmxi3223-20061001 (JIT enabled)
    > J9VM - 20060915_08260_lHdSMR
    > JIT - 20060908_1811_r8
    > GC - 20060906_AA)
    > JCL - 20061002
    >
    > And the manual says:
    > OES 2 Linux / SLES 10
    > Apache 2.2 plus:
    > Tomcat 5 or later
    > Tomcat 5 is included with the Linux operating system.
    > JRE 5 or later
    > ModProxy Module
    >
    > And rpm -qa | grep java
    > java-1_5_0-ibm-1.5.0_sr3-13.10
    >
    >
    > With regards,
    >
    > Alex
    >
    >
    Sorry, you are not running Java 5. I know you think you are, and I
    don't know how to prove there is an older Java (probably 1.42) installed
    somewhere). But there is
    > java.lang.UnsupportedClassVersionError:
    > com/novell/webaccess/WebAccessServlet (Unsupported major.minor version
    > 49.0)
    This error can ONLY occur if the JVM is running too old a version. As it
    happens 49.0 is 5.0 (50 is 6.0, 51 is 7.0).
    java -version doesn't prove much. (that proves a version of java you
    have is 1.5, but not that tomcat is running it). Go to the tomcat dirs,
    find the bin directory and try running startup.sh directly there. IIRC
    it spits out the JAVA_HOME var it is using.

  • J2sdkee 1.3 ERROR org.apache.catalina.connector.ResponseStream.flush(Respon

    Hi all
    Hope someone can help me out on this one.
    I can start the server ok but when I try and look at
    http://localhost:8000/index.html I get this exception in the command window:
    java.lang.NoSuchMethodError
         at org.apache.catalina.connector.ResponseStream.flush(ResponseStream.java:209)
         at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:245)
         at java.io.PrintWriter.flush(PrintWriter.java:120)
         at org.apache.catalina.connector.ResponseWriter.flush(ResponseWriter.java:125)
         at org.apache.catalina.connector.ResponseBase.finishResponse(ResponseBase.java:426)
         at org.apache.catalina.connector.HttpResponseBase.finishResponse(HttpResponseBase.java:228)
         at org.apache.catalina.connector.http.HttpResponseImpl.finishResponse(HttpResponseImpl.java:288)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1021)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1088)
         at java.lang.Thread.run(Thread.java:484)
    I have configured the JAVA_HOME, J2EE_HOME and J2EE_CLASSPATH correctly, as far as the documentation tells me. Would I be correct in assuming that I have a missing JAR file, if so any idea which one ?
    TIA Matt

    Solved my problem.
    After checking the CPATH, J2EE_HOME, and JAVA_HOME and finding no problem I found a post on a website that talked about a conflict with servlet.jar in the JAVA_HOME\jre\ext folder and with other versions of Java.
    So I reordered my PATH env variable and put the JDK1.3.1_01 paths at the beginning, as I have Oracle installed and Jbuilder and they have JDK's with them as well. I aslo removed several JAR's from JAVA_HOME\jre\ext (including servlet.jar)....
    and eureka I can now get the congratulations page.
    Not sure if Oracle or JBuilder are going to like it !!!
    regards
    Matt

  • Error NPE at org.apache.catalina.loader.StandardClassLoader.java

    On staring Tomcat Cluster - i get this error:
    org.apache.catalina.cluster.tcp.SimpleTcpCluster start
    SEVERE: Unable to start cluster.
    java.lang.NullPointerException
    at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:804)
    at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:756)
    Any help in pointing out what could be wrong would be greatly appreciated.
    ======
    My Tomcat server.xml - cluster part looks like:
    <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
    managerClassName="org.apache.catalina.cluster.session.DeltaManager"
    expireSessionsOnShutdown="false"
    useDirtyFlag="true">
    <Membership
    className="org.apache.catalina.cluster.mcast.McastService"
    mcastAddr="228.0.0.4"
    mcastPort="45564"
    mcastFrequency="500"
    mcastDropTime="3000"/>
    <!�auto below has been replaced with 127.0.0.1 it still does not help �
    <Receiver className="org.apache.catalina.cluster.tcp.ReplicationListener"
    tcpListenAddress="auto"
    tcpListenPort="4001"
    tcpSelectorTimeout="100"
    tcpThreadCount="6"/>
    <Sender
    className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
    replicationMode="pooled"/>
    <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
    filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
    </Cluster>

    You're right, you posted a new thread, but . . .
    This whole forum is dedicated to Messaging Server
    You might want to find the correct forum to post your question . . . . . . . . . .

  • Java.lang.ClassNotFoundException:myclass org.apache.catalina.loader

    I've been building some HTTP servlets and to ease up on the typing I've created a ServletUtilities file and class for repetitve tasks. I then added this file to my core package. However once I made a call to my ServletUtilites class from the other classes I've been getting:
    HTTP Status 500 - Exception Report
    java.lang.ClassNotFoundException:FactoryClass org.apache.catalina.loader. WebappClassLoader. loadClass(WebappClassLoader.java:1453)

    You're right, you posted a new thread, but . . .
    This whole forum is dedicated to Messaging Server
    You might want to find the correct forum to post your question . . . . . . . . . .

  • Cannot import package org.apache.catalina in Tomcat 4.1

    Hi,
    Don't know why I cannot import org.apache.catalina.realm.RealmBase.*; or org.apache.catalina.*; but no problem in importing org.apache.*; ?
    error prompts "package org.apache.catalina.realm.RealmBase does not exist " Thanks.
    Jackie

    Yes, I can find org.apache.catalina.jar in /lib but why my jsp program cannot locate this class? Something wrong with my web.xml / server.xml? Thank you.

  • Org.apache.catalina.connector.ClientAbortException

    HI
    How to catch ClientAbortException, when I am adding the following line it is showing error. Its not identifying the org.apache.catalina, do I need to add any jar files to my path to identify this exception Please respond..
    org.apache.catalina.connector.ClientAbortException

    I am facing the same problem.
    Can you tell how did you resolve it?

  • Org.apache.catalina.servlets.DefaultServlet??!! Where is the jar?

    Hello,
    My server keeps doing errors like,
    HTTP Status 404 - Servlet default is not available
    type Status report
    message Servlet default is not available
    description The requested resource (Servlet default is not available) is not available.
    Apache Tomcat/5.5.9
    Would you let me know what wrong with Defaultservlet. I set it up with
    <servlet>
    <servlet-name>default</servlet-name>
    <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
    <init-param>
    <param-name>debug</param-name>
    <param-value>0</param-value>
    </init-param>
    <init-param>
    <param-name>listings</param-name>
    <param-value>true</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    But it doesnt work. Pls help me. Where is the jar with Defaultservlet.
    Thanks,
    Tony

    Thanks!
    Would you let me know how to set it up. I know it should be working by default. However, I tried times with reinstallation. Still nothing comes out. This is my servlet mapping within web.xml
    <servlet>
    <servlet-name>default</servlet-name>
    <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
    <init-param>
    <param-name>debug</param-name>
    <param-value>0</param-value>
    </init-param>
    <init-param>
    <param-name>listings</param-name>
    <param-value>true</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/</url-pattern>
    </servlet-mapping>
    Tony

  • What is: org.apache.catalina.startup.bootstrap

    This keeps poping up in my dock.
    "org.apache.catalina.startup.bootstrap"
    Why is it there and is it a problem.
    I have not noticed it there in the past four years. It is also seen at shut down.
    Thank you for your help.

    That would be a Java-based loader for the Catalina component of Tomcat, an extension to Apache to handle JavaServer pages. Did you or someone at some time in the past install the Tomcat server on your system?

  • Org.apache.catalina.startup.Bootstrap problem

    Hello,
    My iMac running 10.7.5 launches org.apache.catalina.startup.Bootstrap at startup and I don't know how to get rid of this, or even what it does.
    Also, my network printers have stopped working although I can access their admin pages through their IP addresses. I can print with USB.
    I am not incredibly tech savy, and other searches about this org.apache.... talk about "tomcat" and other things that I have no idea about.
    Any help delivered in a simplistic way would be greatly appreciated.
    Thanks,
    Rob

    Stu,
    I put in a call to Apple, and during the troubleshooting it was suggested that I go to Apple Menu>System Preferences>Users & Groups>Login Items.  I removed two items that I did not know what they were.  Restarted, and this org.apache..... was gone. 
    It turns out that my printing problems were most likely unrelated.  I had rebooted a WAP, and some settings seem to revert to factory.  I am now up 100%.

  • How to read .XLSX files using org.apache.poi.ss.usermodel.* classes

    Hello,
    I want to read in excel files to a JTable. I was able to read in .xls files, but have problems reading .xlsx files. Maybe there is something i need to add to the following code:
    FileInputStream iStream = new FileInputStream(newFile);
    POIFSFileSystem fs = new POIFSFileSystem(iStream);
    Workbook wb1 = WorkbookFactory.create(fs);
    Sheet sheet = wb1.getSheetAt(0);       // get the first sheet data
    // Iterate over each row in the sheet
      Iterator rows = sheet.rowIterator();
       while(rows.hasNext()) {
          Row row = (Row) rows.next();
          .............The compiler is complaining about the 3rd line: Workbook wb1 = WorkbookFactory.create(fs);
    Thanks.

    @ejp:
    I quite agree with you. It's a runtime exception -
    org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF)I've tried searching before coming here to ask. HSSF processes .xls files only, XSSF processes .xlsx files only while SS is supposed to read both .xls and .xlsx files. Maybe there's anyone that has used it before who can help out.
    Thanks

Maybe you are looking for