How to implement logging functonolity in my java application

Hi.
I want to add logging functionality in my java project.Iam using jdk1.5.I have written following log4j.properties.This property file i need to keep it in com.format.src.property folder .All java files are there in com.format.src folder.
log4j.rootCategory=DEBUG, FILE, CONSOLE
### A bootstrap file appender
log4j.appender.FILE=org.jboss.logging.appender.FileAppender
log4j.appender.FILE.File=${jboss.server.log.dir}/${HOSTSHORTNAME}-${jboss.server.name}-boot.log
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
log4j.appender.FILE.Append=false
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=INFO
log4j.appender.CONSOLE.Target=System.out
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
Could you reply me the steps to implement logging in my project.
Thanks in advance
alex

1) Put the Apache Commons Logging jar into your "lib" folder.
2) Create your properties file as "log4j.properties"
3) Keep it inside the folder where you have your "src" (ie. ur "src", "classes", & "log4j.properties" should be in the same folder)
4) Import "org.apache.log4j.Logger;"
5) Create an instance of "Logger" as follows;
Logger log = Logger.getLogger(YourClassName.class.getName());
6) Use the created "log" instance when applicable as follows:
log.info("Whatever the message");
log.debug("Whatever the message");
log.error("Whatever the message");
log.fatal("Whatever the message"); ...etc
Hope u got it... Happy coding... :)
Cheers,
Asela.

Similar Messages

  • How to implement a note on a Java AS(i.e.Enterprise portal)

    Hello
    How to implement a note on a Java AS(i.e.Enterprise portal)
    Thx in advance

    Hi,
    Could you please let us know what kind of note you want to implement on EP ?
    Thanks
    Sunny

  • Best practices on how to implement logging in custom application

    In the Enterprise Manager it is possible to display/browse the content of different log files generated by the application server modules.
    I have some custom web applications which currently use the log4j framework to write to log files. Is it possible to make these log files accesible for the Enterprise Manager ?
    Or what is the best practice on how to implement logging in custom applications which can be browsed in the Enterprise Manager (I do not want to use system.out)

    I thought that this could be done. An ex- colleague did this - but he didn't tell me how to solve this.
    But as it just took 10 minutes to solve this I believe it's fairly easy.
    cu
    Andreas

  • How to create a Batch file for java application  ?

    HI,
    How to create a Batch file for java application ?
    And whats the use of creating batch file ?
    Thanks in advance

    [http://static.springsource.org/spring-batch/]
    Assuming you want to develop a batch application rather than actually just create a .bat file ..

  • HOw to create a Batch file for java application and whats the use of this ?

    HI,
    How to create a Batch file for java application ?
    And whats the use of creating batch file ?
    Thanks in advance

    First of all, you're OT.
    Second, you can find this everywhere in the net.
    If you got a manifest declaring main class (an classpath if needed), just create a file named whatever.bat, within same directory of jar file, containing:
    javaw -jar ./WhateverTheNameOfYourJarIs.jar %*By the way, assuming a Windows OS, you can just double click the jar file (no batch is needed).
    Otherwise use:
    javaw -cp listOfJarsAndDirectoriesSeparedBySemiColon country/company/application/package/className %*Where 'country/company/application/package/' just stands for a package path using '/' as separator instead of '.'
    Don't specify the .class extension.
    Javaw only works on Windows (you asked for batch, I assumed .BAT, no .sh), in Linux please use java.exe (path may be needed, Windows doesn't need it 'cause java's executables are copied to system32 folder in order to be always available, see PATH environment variable if you don't know what I'm talking about) and use ':' as classpath (cp) separator.
    The '%***' tail is there in order to pass all parameters, it only works on Windows, refer to your shell docs for other OSs (something like $* may work).
    This way you have a command you can call to launch your code (instead of opening NetBeans just to see your app working). You could schedule tasks on it or just call it in any command prompt (hope you know what it is 'cause there have been people in this very same forum with no clue about it, if not just hold the 'Windows button' and press 'R', then type 'cmd' and run it).
    Finally add dukes and give 'hem away.
    Bye.

  • How to deploy a POJO or a java application in oracle ESB?

    hi,
    I m beginner in oracle ESB.
    please someone tell me how to deploy a POJO or a java application in oracle ESB?
    thank you.
    Peter.

    The short answer is "you wouldn't"
    The long answer is that you would expose your Java Application or POJO as a Web Service then virtualise it through the ESB.
    If you're wanting to learn more about SOA, ESB and BPEL have you been to this site http://download.oracle.com/docs/cd/B31017_01/index.htm

  • How to assign the Thems into Webdynpro Java Application

    HI All,
                   I Downloaded the plugin for them editor and i add those plugins and i created the Them. Please any one can help me how to add that Them into Webdynpro java application.

    Hi ep bhargav,
    You can check this link.....
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ccb6bcf4-0401-0010-e3bc-ec0ef03e13d1
    Re: webdynpro theme editor
    Thanks.
    Venkat.

  • How to import the image by using java application

    1.how to import the image by using java APPLICATION and display it on the textarea that you have been created.
    2.how to store the image into the file.
    3. what class should i used?
    4. how to create an object to keep track the image in java application.
    * important : not java applet.
    plzzzzzzz.
    regards fenny

    follow the link:
    http://java.sun.com/docs/books/tutorial/2d/images/index.html

  • How to create the exe files for java application

    How to create the exe file for java application?
    got any software to do that?
    Thanks

    In terms of converting java applications into exe files, there are 3 schools of thought:
    1) Instead of converting it to an exe, convert it to a jar file. Jar files are more portable than exe files because they can be double-clicked on any operating system. The caveat is that a Java interpreter must be installed on the target computer for the double-clicking to work.
    http://developer.java.sun.com/developer/Books/javaprogramming/JAR/
    2) Create an exe launcher that, when double-clicked, attempts to find a Java interpreter on the local computer and launches the Java application. The exe file is still double-clickable but whether your java application runs depends on whether a Java interpretor is installed on the target computer.
    http://www.sureshotsoftware.com/exej/
    http://www.objects.com.au/products/jstart/index.jsp
    http://www.duckware.com/products/javatools.html
    http://www.ucware.com/jexec/
    http://www.rolemaker.dk/nonRoleMaker/javalauncher/
    http://www.jelude.cjb.net/
    http://thor.prohosting.com/~dfolly/java/index.html
    3) Create an exe launcher that bundles a Java interpretor. Same as above but when the exe file is double-clicked, it searches for a Java interpreter and if one is not found, it installs one on the target computer. The caveat is that the exe file would have an overhead of 10 MB in size for the interpreter.
    http://www.excelsior-usa.com/jet.html (evaluation version available)
    4) Convert the Java application into a native exe file. The caveat is that if you use Swing for your GUI, it won't be converted. Also this option is still somewhat experimental.
    Can't think of any free options right now.

  • Can anybody tell me how to send/receive  the sms from java application

    Hi All,
    Can any body tell me, how to send/receive the sms from java application to mobile phones.
    I have installed the jsms engine and when i try to connect to the mobile device ,the jsms server is giving
    the following error.
    Cannot connect to GSM Device, error : -11

    Which jsms? Google finds several.
    Try the website where you downloaded it.

  • Can any body tell me, how to send/receive the sms from java application

    Hi All,
    Can any body tell me, how to send/receive the sms from java application to mobile phones.
    I have installed the jsms engine and when i try to connect to the mobile device ,the jsms server is giving
    the following error.
    Cannot connect to GSM Device, error : -11

    The best place to ask your question is at the JSMS website, forum or mailing list since this is no error that directly comes from a class belonging to the core Java classes.

  • How to implement the security notes in Java System.

    Hi All,
    For the ABAP systems we use RSECNOTE to implement the security notes, but how do we do that in Java systems?
    Any reference or guidance will be of great help.
    Thanks,
    Akash.

    RSECNOTE is for ABAP only, and I dont think there is any equivalent for Java.
    For Java , security note will guide you on how to implement.
    It could be manual changes or via SDM or JSPM.
    Regards,
    Pinkle

  • How to implement " log on locally" via Domain Group Policy

    Hello,
    Thanks for always being very helpful.
    My Goal:
    I want to restrict one domain user to login to one computer only  (admin/root users to login to every computer).
    I searched and I believe there is no such direct way to implement via the group policy unless I may add one GPO per user to implement"log on locally" from the group policy.
    Do you have some VB script or other good way so I should not login to each computer one by one and edit the policy manually.
    Thanks in advance.
    Muhammad Asif Server Administrator Linux/Windows

    I am sorry if I wasn't cleared, I am managing about 250 users and want accomplish from some centralized locations. I don't want to go to every machine and apply the changes.
    I want to let one domain user to login to one system only.
    I have the list of computer name VS username, and I want to apply from centralized location without login to each computer one by one.
    Thanks a lot for the assistance.
    Muhammad Asif Server Administrator Linux/Windows
    The solution can only be applied once at the DC with ADUC or with Set-ADUSer as I posted.  It only needs to be run once from one DC.
    ¯\_(ツ)_/¯

  • How to open JSP session from a java application or an applet?

    Hi,
    My problem is a bit challenging (at least for me) and its not about JSP but it is about a web application..
    I couldnt find a better place to post this question I am sorry if this is not the right place to post it..
    I need to enable users log into my website by checking username and password and reading and checking the data from a usb device located in client computer.
    I can read from the device thorough JNI using the third party DLL file for the device... I have no problem with that..
    Since I need to make native calls I am planning to develop a java application so I let the users open the application using web start.. Once my application is running on client side after reading the device and getting login password information (assuming login information correct), How can I open a web session for the that spesific user and a web browser and let the user browse the web site on his/her own session?
    I would appreciate any guidance..
    Thanks..

    add the values in the header using...
    response.addHeader("userNmae","XXXX");use it in all ur pages like say..
    if(!request.getHeader("userName")!=null && request.getParameter("userName").equlas(""))
    String username=request.getParameter("userName");
    }

  • How to use  third party package in java application

    hi, i am a student , new to java world can any of u tell me how to import third party package in our java application.
    i want to know how CLI is done in java.
    i am going thru this link http://www.codezoo.com/pub/component/5574
    not able to get anything.
    please please help me

    There are two steps -
    1. Import the classes you need from the package(s) using the Java import statement in your classes that need access to them.
    2. include the 3rd part code (one or more .jar files and/or root directories holding the code's package tree and .class files) to your javac and java class path and optionaly to the class path found in your .jar's manifest file.

Maybe you are looking for

  • Taking One Step At A Time...

    I've been lurking for a while, and taking heed to all advice given...before coming in Myfico, my scores were terrible---mid to high 500's. In April of this year, I pulled all three credit reports and began disputing incorrect information (I had 8 acc

  • Icons in bookmark bar

    does anyone know how to replace the text in the bookmarks bar with icons like google chrome does?

  • [SOLVED] Wireless installation

    My wireless internet connection works like a charm with Ubuntu and the network-manager applet only by providing the wireless pass phrasse, but it seems like I can't get it work in my archlinux fresh install. 1- I installed required wireless_tools and

  • I got my copy og photshop cs5 with the purchase of my intuos4 tablet, &made a copy as was instructed

    unfortunately the flash drive i used as a back up got corrupted or lost a file. I was given an error 1 and told come here to help get that software back. i do have all the reg. keys and my intuose disk that would or should bring me right to the page

  • Creating pdf from multiple word docs standard 6.0

    every time i open standard 6 it says it is configuring, when i try to create a pdf from multiple files it says " unable to find adobe pdf resource files" running repair does not help, I have edited prefernces and selected microsoft office, have unins