Extending Log4j for mulitple log files

Hi,
I need to use Log4j logging utilities and log to different files depending on some set parameters. In a simplistic example, based on a passed parameter, the EJB must log to different files for different invokeations of the same method.
Any help would be greatly appreciated.
Thanks
B K Adarsh

Create double categories for the same class. category1.debug("Logging to one file");
if(shouldIUseTheOtherCategoryToo == true){
  category2.debug("Logging to the other file");
}/Michael

Similar Messages

  • Changing Log4j properties for the log file

    Hi All
    I want to set up some log4j properties(format ..etc) for the log file located at
    <OracleAS_HOME>\opmn\logs\default_group~home~default_group~1.log
    But i am unable to find the xml file where I can tune the properties. Any pointer will be of great help!!
    Thanks

    Hi
    opmn.xml has entry for opmn\logs\opmn.log only.... can't find the entry for the log file i need
    Thanks

  • "recover database until cancel" asks for archive log file that do not exist

    Hello,
    Oracle Release : Oracle 10.2.0.2.0
    Last week we performed, a restore and then an Oracle recovery using the recover database until cancel command. (we didn't use backup control files) .It worked fine and we able to restart the SAP instances. However, I still have questions about Oracle behaviour using this command.
    First we restored, an online backup.
    We tried to restart the database, but got ORA-01113,ORA-01110 errors :
    sr3usr.data1 needed media recovery.
    Then we performed the recovery :
    According Oracel documentation, "recover database until cancel recovery" proceeds by prompting you with the suggested filenames of archived redo log files.
    The probleme is it  prompts for archive log file that do not exist.
    As you can see below, it asked for SMAarch1_10420_610186861.dbf that has never been created. Therefore, I cancelled manually the recovery, and restarted the database. We never got the message "media recovery complete"
    ORA-279 signalled during: ALTER DATABASE RECOVER    LOGFILE '/oracle/SMA/oraarch/SMAarch1_10417_61018686
    Fri Sep  7 14:09:45 2007
    ALTER DATABASE RECOVER    LOGFILE '/oracle/SMA/oraarch/SMAarch1_10418_610186861.dbf'
    Fri Sep  7 14:09:45 2007
    Media Recovery Log /oracle/SMA/oraarch/SMAarch1_10418_610186861.dbf
    ORA-279 signalled during: ALTER DATABASE RECOVER    LOGFILE '/oracle/SMA/oraarch/SMAarch1_10418_61018686
    Fri Sep  7 14:10:03 2007
    ALTER DATABASE RECOVER    LOGFILE '/oracle/SMA/oraarch/SMAarch1_10419_610186861.dbf'
    Fri Sep  7 14:10:03 2007
    Media Recovery Log /oracle/SMA/oraarch/SMAarch1_10419_610186861.dbf
    ORA-279 signalled during: ALTER DATABASE RECOVER    LOGFILE '/oracle/SMA/oraarch/SMAarch1_10419_61018686
    Fri Sep  7 14:10:13 2007
    ALTER DATABASE RECOVER    LOGFILE '/oracle/SMA/oraarch/SMAarch1_10420_610186861.dbf'
    Fri Sep  7 14:10:13 2007
    Media Recovery Log /oracle/SMA/oraarch/SMAarch1_10420_610186861.dbf
    Errors with log /oracle/SMA/oraarch/SMAarch1_10420_610186861.dbf
    ORA-308 signalled during: ALTER DATABASE RECOVER    LOGFILE '/oracle/SMA/oraarch/SMAarch1_10420_61018686
    Fri Sep  7 14:15:19 2007
    ALTER DATABASE RECOVER CANCEL
    Fri Sep  7 14:15:20 2007
    ORA-1013 signalled during: ALTER DATABASE RECOVER CANCEL ...
    Fri Sep  7 14:15:40 2007
    Shutting down instance: further logons disabled
    When restaring the database we could see that, a recovery of online redo log has been performed automatically, is it the normal behaviour of a recovery using "recover database until cancel"  command ?
    Started redo application at
    Thread 1: logseq 10416, block 482
    Fri Sep  7 14:24:55 2007
    Recovery of Online Redo Log: Thread 1 Group 4 Seq 10416 Reading mem 0
      Mem# 0 errs 0: /oracle/SMA/origlogB/log_g14m1.dbf
      Mem# 1 errs 0: /oracle/SMA/mirrlogB/log_g14m2.dbf
    Fri Sep  7 14:24:55 2007
    Completed redo application
    Fri Sep  7 14:24:55 2007
    Completed crash recovery at
    Thread 1: logseq 10416, block 525, scn 105140074
    0 data blocks read, 0 data blocks written, 43 redo blocks read
    Thank you very much for your help.
    Frod.

    Hi,
    Let me answer your query.
    =======================
    Your question: While performing the recovery, is it possible to locate which online redolog is needed, and then to apply the changes in these logs
    1.   When you have current controlfile and need complete data (no data loss),
          then do not go for until cancel recovery.
    2.   Oracle will apply all the redologs (including current redolog) while recovery
         process is    on.
    3.  During the recovery you need to have all the redologs which are listed in the    view    V$RECOVERY_LOG and all the unarchived and current redolog. By querying  V$RECOVERY_LOG  you    can find out about the redologs required.
    4. If the required sequence is not there in the archive destination, and if recovery process    asks for that sequence you can query V$LOG to see whether requested sequence is part of the    online redologs. If yes you can mention the path of the online redolog to complete the recovery.
    Hope this information helps.
    Regards,
    Madhukar

  • What is the extension for debug log file name?

    Hi,
    1) Please let me know what is the extension for debug log file....
    is it .dbg or .log ?
    in one of the sr the service engineer asked to put .log as the extension is this correct?
    here is what he said...
    a) Enable the following Profiles at user level:
    OM: Debug Level = 5
    INV: Debug Trace = YES
    INV: Debug Level = 11
    INV: Debug File = [directory value from above query]/logfilename.log
    (make sure that you have write permission for this file and directory)
    WSH: Debug Enabled - Yes
    WSH: Debug Level - Statement
    2) do the end-user (for whom trace is enabled) need to have read and write permissions on the directory and the log file?
    Thanks
    Raju

    user652672 wrote:
    1) Please let me know what is the extension for debug log file....
    is it .dbg or .log ?
    INV: Debug File = [directory value from above query]/logfilename.log
    (make sure that you have write permission for this file and directory) It is what you set in the value of "INV: Debug File" profile option (according to the above value, it will be logfilename.log).
    2) do the end-user (for whom trace is enabled) need to have read and write permissions on the directory and the log file?No, just make sure the directory is writable by the oracle and applmgr users.

  • Posting errors through Log4j in weblogics log file

    I am running portlet application , if i want to print all error messages inside weblogic's Log file how can i do it , please explain me full procedure

    Step 1. Copy log4j-1.2.9.jar & wllog4j.jar under domain_root/lib folder.
    Step 2. Create log4j.xml and drop it under domain_root folder. If you have log4j.xml inside the application(EAR/WAR), I would recommend to move outside EAR/WAR as
    changing severity (log level) would require re-deployment. To avoid this, we can move log4j.xml into domain root folder but again the server needs to be bounced.
    But there is a fix.
    Step 3. Login to weblogic server console. Go to Servers -> Admin Server-> Logging.
    Click on advanced mode. Change the logging implementation from JDK to Log4J.
    Click save.
    Step 4. Activate changes. Re-start the admin server.
    This should enable log4j and should write logging into log file mentioned in log4j.xml or properties file.
    Hang on! There is a catch here. Say now I want to change the log level from DEBUG into WARN or ERROR.
    How do i do?
    We go to log4j.xml and change the level.
    Now how does this change take into effect? It needs bouncing of the server.
    I have given below sample log4j.xml for your reference...
    log4j.xml:
    <?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE log4j:configuration SYSTEM
    "log4j.dtd">
    <log4j:configuration>
    <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
    <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern"
    value="%d [%t] %-5p %c - %m%n"/>
    </layout>
    </appender>
    <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
    <param name="File" value="/log/myApp.log"/>
    <param name="Append" value="true"/>
    <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%d{ISO8601} %t %-5p %c{2} - %m%n"/>
    </layout>
    </appender>
    <logger name="org.apache">
    <level value="WARN"/>
    </logger>
    <logger name="org.springframework">
    <level value="WARN"/>
    </logger>
    <root>
    <level value="DEBUG"/>
    <appender-ref ref="FILE"/>
    <!-- <appender-ref ref="CONSOLE"/> -->
    </root>
    </log4j:configuration>
    I have disabled log4j to write int
    I Followed all these steps , but finally i am getting an empty file myApp.log at specified destination , i want all log messages inside that file when WEBLOGIC starts , so what needs to be done for that

  • Change block size for several log-files simultaneously?

    Hi,
    I'm using SignalExpress to record and analyze data.
    Sometimes I want to analyze the recorded data both for a short period of time and for longer time.
    (Imagine creating an average of every second first and then an average of every 10 seconds)
    Then I need to change all the log-files, and also the specific parts of the log-file. See attachment.
    I have sometimes up to 1000 log-files containing signals from 4 different modules, that makes 4000 adjustments to change from block size 10000 to block size 1000.
    Is there any way to adjust all the log-files block size at once?
    Many thanks!
    Anders Hansson
    Engineer
    Attachments:
    NI.JPG ‏95 KB

    Hi,
    Is't anyone else interested in a solution for this operation?
    I reported this to the NI-feedback service and they adviced me to report/request advice here to get a quicker reply.
    So...
    Best regards
    Ingenjör Hansson

  • How to calculate storage space for archive log files and database backups?

    Hi all,
    I have a 1.8 terabyte Oracle 9i database and need to plan for how much additional disk space I will need to perform nightly backups and for archivelog files. Is there a script or formula available that can help me estimate how much required disk space I will need to hold a days worth of archived logs as well as a nightly export dump file and a full hot RMAN backup on disk?
    Thanks!

    I'm not sure how to estimate the size of your backups, especially if you use incrementals. However, the space required for archive logs will be equal to the amount of REDO your DB generates. I would count the number of log switches per day with a query like the following:
    select trunc(first_time), count(*)
    from v$log_history
    group by trunc(first_time)
    I would then take the average and multiply this count by the size of your redo log files (assuming they are all the same size).

  • Resources For Large Log File

    I wrote a LogFile class that opens a BufferedWriter on the specified file and writes to it when called. The constructor is as follows:
    m_bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(m_strLogFile, true)));
    m_logFile = new File(m_strLogFile);
    I have a max log file size set to 2 megs (at which point the file is archived and reset). This limit has worked great. However, now that my system is seeing more usage, I'd like to raise the max limit to 5 megs. I've done that and all appears ok. My question is whether the JVM uses more resources for the 5 meg file than the 2 meg, or does it only keep track of a pointer to the end of the file and append to that. I'm hoping the latter is the case, so that the file size is irrelevant. However, if there might be performance difficulties writing to a file that size, I'll keep the limit at 2 megs.
    Michael

    I have a max log file size set to 2 megs (at which
    point the file is archived and reset).I suppose it really depends on how you are doing that.
    However, unless you explicitly set a buffer size somewhere that is 2 megs, then normal file io is going to use about 512 or 1k, regardless of the file size. If you use a buffered writer in java it will use 512 bytes (I believe) and the low level os will use about 512. The actual number of bytes might be 256 up to about 4k on the OS side, but I think most buffers are around 512 these days.

  • Following omf for redo log files

    Hi,
    when DB_CREATE_ONLINE_LOG_DEST_1 IS set then I would like to
    know whether 2 log groups would be created at the location specified if yes then in archive log mode whether this would create any problems .

    Before DBWn can write a modified buffer, all redo records associated with the changes to the buffer must be written to disk (the write-ahead protocol). If DBWn finds that some redo records have not been written, it signals LGWR to write the redo records to disk and waits for LGWR to complete writing the redo log buffer before it can write out the data buffers.
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14220/process.htm#i21918

  • Where to look for log files & crash reports to help debug lockups?

    Where would I look for possible log files or crash information that may provide clues on what the problem is?
    Three or four times in the past few days my system has became unresponsive requiring a power-cycle. The little prism-colored round-cursor appears. I can drag windows about with my BlueTooth mouse (but not the trackpad) and that's about. The Function keys are not responsive. Other times the UI may becomes totally unresponsive.
    A couple of weeks ago I Carbon Copy cloned my hard drive to a new 500GB Hitachi 7200 RPM ( I have 200GB free space now ). Before upgrading, I do not recall having had this problem. It usually occurs when I am running a Linux Red Hat Enterprise Linux 5.2 VM under Parallels. Parallels may have nothing to do with it as that's what I do all day ( develop Linux software in a VM ).
    I have a MacBook Pro 2.4Ghz, OS X 10.6.3.
    Thanks in advance for any tips or suggestions,
    -Ed

    This is a Mac OS X issue. I am not using Boot Camp or otherwise dual-booting. I am running Linux in a virtual machine under a Parallels Mac OS X host; in effect running Linux as an application under OS X.
    Unfortunately I did not see any clues in either log file location. Thank you very much for explaining where to look. I ran Disk Utility and repaired a bunch of permissions. Perhaps I should have done this before and after making the Carbon Copy clone.
    -Ed

  • Needed a code for Creating a Log File in java so that its size is limited

    Hi
    I need the code for developing a log file using threads so that the log file size is limited
    and if the size of the log file is increasing above 1Mb,another log file has to be created automatically and the log have to be printed into that new file.
    Thanks in advance

    package cms.web.log;
    import java.io.*;
    import java.util.Calendar;
    import cms.web.WebUser;
    *     Log is generated by JEditor 1.0.0
    *     @Project      : cms
    *     @Version      : 1.0.0
    *     @Created date : 11:07:40  PM Thursday, 25/07/2002
    *     @Author       :
    *     @Organization :
    *     @Copyright    : (c) 2002
    *     An utility class used to write information, especially error messages, to
    *     log file so that they can be viewed at later time by administrators.
    *     Extra information such as date & time they occures & where they are thrown...
    *     are automatically included and append to the end of log file.
    *     Log files will increase with the format "name_n" where n is file counter
    public class Log implements Serializable
          *     logs marker
         static final String START= "\n\0";
          *     parent directory that contains log files
         private static File parent;
         private PrintStream out;
         private String name;
          *     to count how many log for the current stream
         int counter;
          *     maximum number of logs for each log file
         int max;
         public static void init(File parent)
              if (!parent.exists())
                   parent.mkdirs();
              Log.parent= parent;
         public Log(String name, int max)
              this.name= name;
              this.max= max;
              file= getLastFile();
              counter= countLogs(file);
              out= openStream(file);
         public synchronized void appendLog(String log)
              if (log == null || log.length() == 0)
                   return;
              count();
              try {
                   out.println(START+ counter+ " | "+ getCurrentTime()+ " | "+ log);
                   out.flush();
              } catch (Exception e) {}
          *     Append the given log to log file.
         synchronized void appendLog(String msg, WebUser user)
              if (msg == null || msg.length() == 0)
                   return;
              count();
              try {
                   out.println(START+ counter+ "----------------------------------------------------------");
                   out.println(getCurrentTime());
                   out.println(user != null? "User:"+ user.getFullName(): "User: public user");
                   out.println(msg);
                   out.println("\n----------------------------- end -----------------------------\n");
                   out.flush();
              } catch (Exception e) {}
          *     Append the given exception to log file
         synchronized void appendLog(Throwable error, WebUser user)
              if (error == null)
                   return;
              count();
              synchronized (out)
                   try {
                        out.println(START+ counter+ "----------------------------------------------------------");
                        out.println("Exception occured at "+ getCurrentTime());
                        out.println(user != null? "User: "+ user.getFullName(): "User: public user");
                        error.printStackTrace(out);
                        out.println("----------------------------- end -----------------------------\n");
                        out.flush();
                   } catch (Exception e) {}
         private String getCurrentTime()
              Calendar c= Calendar.getInstance();
              return
                   parse(c.get(Calendar.HOUR_OF_DAY))+ ":"+               // 0 --> 23
                   parse(c.get(Calendar.MINUTE))+ ":"+                     // 0 --> 59
                   parse(c.get(Calendar.SECOND))+ " "+                     // 0 --> 59
                   parse(c.get(Calendar.DAY_OF_MONTH))+ "/"+                 // 1 --> 31
                   parse(c.get(Calendar.MONTH)+ 1)+ "/"+                     // 1 --> 12
                   c.get(Calendar.YEAR);                                        // yyyy
         private String parse(int n)
              return n< 10? "0"+ n: ""+ n;
         private void count()
              counter++;
              if (counter> max)
                   incrementFile();
                   counter= 1;
         private void incrementFile()
              File file= null;
              int n= 0;
              while ((file= new File(parent, name+ n+ ".log")).exists())
                   n++;
              if (out != null)
                   out.close();
              out= openStream(file);
         private PrintStream openStream(File file)
              try {
                   if (file.exists())
                        return new PrintStream(new FileOutputStream(file.getPath(), true));
                   else
                        return new PrintStream(new FileOutputStream(file.getPath()));
              } catch (IOException e) {
                   throw new RuntimeException(e.getMessage());
         private int countLogs(File file)
              int count= 0;
              InputStream in= null;
              try {
                   in= new FileInputStream(file);
                   int n;
                   while ((n= in.read()) != -1)
                        if (n == '\0')
                             count++;
              } catch (IOException e) {
              } finally {
                   if (in != null)
                        try {
                             in.close();
                        } catch (IOException e) {}
              return count;
         private File getLastFile()
              File file= new File(parent, name+ "0.log");
              File curr;
              int n= 1;
              while ((curr= new File(parent, name+ n+ ".log")).exists())
                   file= curr;
                   n++;
              return file;
         protected void finalized()
              if (out != null)
                   out.close();

  • File system log files for SOA Gateway

    Hi All,
    I need to get log files for my integration repository/SOA Gateway since I'm not able to generate any WSDL or to deploy a web service. In the SOA trouble shoot document, it says:
    Log on to Oracle E-Business Suite with the username that has the System Administrator responsibility access privilege.
    Select the System Administrator responsibility from the Navigator and choose Oracle Applications Manager > Logs.
    Click Log Setup to open the Java System Property Settings page.
    Click the Site link and enable log for
    Midtier Log File Name: Enter the file name that you would like on the middletier, for example, '/tmp/SOA /tmp/SOALog.log'.
    Module=Enter an appropriate module name, for example, 'fnd.soa%'.
    Ask your System Administrator to bounce oafm container.
    Perform any SOA specific action, such as generate a WSDL file for an PL/SQL API.
    Look for logs in the file specified in the Midtier Log File Name field.
    My problem is, that my EBS installation is running on windows, so '/tmp/SOA /tmp/SOALog.log' will not work, right? I tried something like /temp/... or c:/temp/... or c:\temp\... but I did not get a logfile called SOALog.log.
    What do I have to provide as path here?
    Many thanks,
    Konrad

    Hi!
    Did you encounter any error?Yes!
    >
    try givng C:\temp remember temp should have read and write permissions for the oracle applications o/s user(applmgr)Using c:\temp\test.log results in the following error while saving the log setting:
    An error has occurred!
    For input string: "10001:\temp\test.log"
    I can use whatever string I want, but as long as a ":" is included, I get that error.
    As for the user permissions. I installed the EBS using the standard Administrator account and this account is a member of Administrators and ora_dba.
    Best,
    Konrad

  • Where can I find the LOG file for bash/command history typed into Terminal?

    Where can I find the LOG file for bash/command history typed into Terminal?
    For 2 weeks ago I was searching for a log file on my server. Somehow I opend a file where I could see a list of all bash-commands I had ever entered into OSX Terminal.
    Now I need this file.. but cant find it.
    What is the official location for this LOG file?
    Thank you so much for helping.

    cat .bash_history

  • Extending HTTP access log file

    I am trying to extend the HTTP access log file using the information given at http://e-docs.bea.com/wls/docs81/adminguide/web_server.html#113868
    However, I havent been able to succeed in doing that. I have written my own class
    authType.java to display that information in the log file. I compiled the class
    and placed it under the lib directory thereby guaranteeing that it will be loaded.
    However, the log file only seems to place a '-' at the location where it should
    have actually placed the contents of the method getMethod().
    Help will be appreciated.
    [authType.java]

    Not at the moment. We are working on adding a property in an upcoming
    release.
    This is documented at:
    http://www.weblogic.com/docs51/adminhelp/AdminPropertyHelp.html
    Thanks,
    Michael
    Michael Girdley
    Product Manager, WebLogic Server & Express
    BEA Systems Inc
    Sean Scott <[email protected]> wrote in message
    news:8fhpl1$50t$[email protected]..
    Is there a property to set the max size of the http access.log file?

  • How to create and manage the log file

    Hi,
    I want to trace and debug the program process.
    I write the code for creating log file and debugging the process.
    But i am not able get the result.
    please help me how to create and manage the log file.
    Here i post sample program
    package Src;
    import java.io.*;
    import org.apache.log4j.*;
    import java.util.logging.FileHandler;
    public class Mylog
         private static final Logger log = Logger.getLogger("Mylog.class");
         public static void main(String[] args) throws Exception {
         try {
           // Create an appending file handler
            boolean append = true;
            FileHandler handler = new FileHandler("debug.log", append);
            // Add to the desired logger
            Logger logger = Logger.getLogger("com.mycompany");
            System.out.println("after creating log file");     
              catch (IOException e)
                   System.out.println("Sys Err");
            }Please give the your valuable suggesstion... !
    Thanks
    MerlinRoshina

    Just i need to write a single line in log file.

Maybe you are looking for

  • How to use a 3rd party source control tool with RoboHelp?

    Hello, I would like to set our RoboHelp users up with source control.  They are using RoboHelp HTML 8.0. Our software developers are using the AccuRev scm system; I'd like the doc team to use AccuRev, too. Can someone direct me to RoboHelp documentat

  • Links work in iWeb but not on web

    I created a site (http://www.busybeetrader.com) in iWeb 1.2.2 and uploaded using Cyberduck FTP software. The links work in iWeb when I un-check the option to make them inactive. Once I upload my site, several of the links don't work. This has occurre

  • How to get selected annoatation thru notification

    Hi , I want to know that thru which notification, I can get selected annotations. I tried to use AVDocDidSetSelection but this works when I select only one annoation . And whenever I select more annotation using ctrl key then I don't get DidSetSelect

  • Reg: Outside In Webservice

    Hi I created a Outside in WS from a wsdl (ABAP WS) and chose generate java skeleton option on the wsdl. It creates a Stateless session bean as impl bean. Since it does not have a webservice annotation I chose to generate a WS out of it. Then i wanted

  • G4 Start up/PMU problem

    I have an older G4 350mhz (I think it's the aka Yikes model) It's been working great but recently there was no start-up chime and the screen wouldn't come on but the light on the front came on plus the fans. I pressed the PMU button on the motherboar