Java Logging API

Hello,
Can someone please explain when I would want to use FINE versus FINER versus FINEST for my log messages? Most tutorials explain roughly what these are, but I haven't seen anything that explains their use from a practitioner view. Some code would be very helpful, but I'll take anything less ambiguous than more, even more, even more more.

Is my post worded poorly? I'm trying to figure out why nobody has replied (holidays?) Please let me know if this needs clarification. Thx.

Similar Messages

  • Practical use of Java Logging API

    There was a recent technical tip about the Java Logging API, but after reading it I still don't understand how to use it in a real situation.
    Can anyone help me with this with a practical example?
    At the moment I have try-catch clauses that catch exceptions and print a message in a System.err log that I can consult if there's a specific problem.
    How should I be using the Logging API? I feel sure that it can help me, but can't see how.
    Thanks for any practical information.

    What if you don't want to write to system.err anymore? What if you need to write something to the windows event log? What if system.err is irrelevant (nt service), ...
    Btw, lots of examples on the JDK1.4 logging api:
    http://www.esus.com/docs/GetIndexPage.jsp?uid=265

  • Problem with java logging API

    Hi there
    It`s the first time I`m using (I have to use) the standard java logging API.
    My need is to integrate it in an existing web-application based on struts.
    So my first step was to include the following code into an Struts Action-class:
    FileHandler file = new FileHandler("/pathToLogFile/myLogFile.log",true);
    file.setFormatter(new SimpleFormatter());
    logger.info("create info");
    By intention is to have exactly one log-file for the whole application, but indeed I'm getting multiple log-files, even for each request of one and the same Action/Servlet class, like
    myLogFile.log
    myLogFile.log.1
    myLogFile.log.2
    myLogFile.log.3
    Why does using append=true not work in the constructor of "FileHandler"
    Do I have to close the FileHandler each time I've used it?
    Is this a known issue?
    Thanks for any responds!

    @ Stone.li
    First, thanks for your answer.
    perhaps my question was quite confusing .... but my need is just
    to establish the logging API in an existing Web-Application and to have exactly one log-file for the whole application. This means I would have to provide in each servlet a FileHandler referencing to the log-file. I thought it would be part of the job of the logging API to synchronise this file access.

  • Java logging API (1.4) -- where's the file?

    Where on God's green earth does the log file get written to?
    I am doing some very simple code:
    import java.util.logging.*;
    public class SimpleLogging {
       static Logger jcfeLog = Logger.getLogger("test1");
       static Logger sampleLog = Logger.getLogger("test2");
       public static void main(String [] args)
          jcfeLog.warning("sample warning");
          sampleLog.log(Level.INFO, "sample info entry");
          byte[] moreInfo = new byte[10];
          //fill moreInfo with some binary info
          jcfeLog.log(Level.FINEST, "Some obscure event", new Object[]{moreInfo});
    } doesn't get much simpler, plus I am using the default properties file. I get the console output but simply cannot find the log file anywhere on my system. Just for kicks, here is the config entry for the file:
    java.util.logging.FileHandler.pattern =%t/java%u.logmy understanding is that it should go to the temp directory?
    also, why aren't the specs for the config file listed anywhere, all these %t, %u, etc.....????

    The FileHandler API gives the meaning for the % symbols.
    http://java.sun.com/j2se/1.4/docs/api/java/util/logging/FileHandler.html
    Your pattern indicates that the file should be put in the system's temp directory, with the file name java###.log.
    Maybe you should try calling the addHandler method on your Loggers, and add a FileHandler to write the messages to that file.

  • Customize Java logging API

    Want to customize java.util.logging api, like write message to message queue, xml file, etc. Would you guys give me some useful suggestion or resource or link? Thanks.

    Just write a sub-class of Handler such as this:
    public class JMSHandler extends Handler {
    }Look into the JDK source code such as MemoryHandler and StreamHandler on how to implement it.

  • Java Logging in OC4J

    I use the Java Logging API in several web applications. Now I need to deploy these applications to OC4J.
    In the standalone version of OC4J 10.1.3 I can the log messages in the console. But I would like to see the log messages in the Enterprise Manager.
    In the Enterprise Manager there is an application.log file for each web application. How can I direct my java logging messages to these files? Or something similar so that I can browse/search the log messages in the Enterprise Manager ?
    I have tried to read everything I can find on the OTN web site. The developers guide has something on logging, but I can not get it to work.
    Can anyone please provide me with some glues/guidelines/short example on how I can get this to work?

    Onw way of writting to these files is to use the log methods in GenericServlet (inherited by HttpServlet):
    http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/GenericServlet.html#log(java.lang.String)
    http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/GenericServlet.html#log(java.lang.String, java.lang.Throwable)
    or these log methods in ServletContext:
    http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#log(java.lang.String)
    http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#log(java.lang.String, java.lang.Throwable)
    I have done this succesfully.
    Chris

  • Use Java Logging mechanism

    We have a requirement to log application errors in a local log file in the form of key/value pairs (from a property object) after every transaction, append to the previous transaction and generate one log file for each day.
    Log file example,
    currentTime=xxxx
    message=xxxxx
    userId=xxxx
    etc.
    What would be the best way to do it ? Can I take advantage of the Java Logging API, like file handler , although it does not do exactly what I wanted ?

    Thanks for the reply. But the company standard does
    not allow open source package like log4j.Then the company standard is completely nuts... but they're like that aren't they... I'd still get a copy of the log4j source from the apache site, to use a working example of how to do it well... then maybe write a simplified "write behind" logging service based on it... a single format "log4j-lite"
    Have fun with it.
    Keith.

  • Java logging materials?

    I have two questions regarding the java logging api
    1) are there any good books or online tutorials that discuss the java logging api available with 1.4?
    2) the SocketHandler class seems to be for sending log messages into the network. is there an equivalent server class for receiving log messages and handling them?
    thanks,
    sunny.

    Thanks for the link. This article in conjunction with Sun's java logging overview helped in demystifying java logging a little. I'm a grad student hoping to work with java logging for my project. An authoritative book would be a great help. When can books on this subject be expected?
    Sunny.

  • Using Java Mail API from Tomcat

    Hello,
    Purely as an academic exercise I have written a JSP page which, upon being requested from the client's browser, should send me a default email using Java Mail Api.
    here is the code :
    import java.util.*;
    import java.io.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    public class TestMail {
        static String msgText1 = "success this time 12";
        static String msgText2 = "This is the text in the message attachment.";
        public String sendIt() {
            String to = "<my email";
            String from = "<anything>";
            String host = "<my ip address of smtp server>";
            boolean debug = false;
            Properties props = new Properties();
            props.put("mail.smtp.host", host);
            Session session = Session.getInstance(props, null);
    .....The code works fine as a stand alone app but when called from JSP page it hangs on the Session.getInstance line. I can only guess that this might be a security issue with the container not allowing access to the smtp server ?
    Can anyone give me a clue ???

    Your Tomcat log files should spell out the problem for you.
    My Tomcat installation does not come with the Java Mail API. I had to add the mail and activation jar files to the server/common.lib directory (or the server's shared/lib or the WEB-INF/lib of your application.)
    HTH.

  • Using Java Logging with WebLogic 8.1

    Hello,
    I am having problems getting custom Handlers to load using the Java 1.4 Logging
    API. Apparently, the custom Handlers are loaded using the System classpath, not
    the applications classpath. This is not a viable option for us, does anyone know
    of a workaround for this?
    Thank you,
    Josh

    Hello Staffan,
    I've just sent to you the code source for this class. By the way I didn't try changing the swing JVM.
    Dom
    Hi,
    This looks like a bug to me. Does it matter which JVM
    you use for the swing application?
    To be able to find out more about the problem it
    would be great if we could look at the class files
    for
    com.dexia.sofaxis.prestations.business.TypeElementMate
    riel and all it's superclasses and interfaces. Please
    contact me offline at sta_larsen(at)hotmail (yes, I
    work for BEA, but I don't like spam...).
    Regards,
    /Staffan

  • Logging api hangs

    Im starting a java application from an applet calling Runtime.getRuntime().exec("java bla bla bla")
    Worked fine until I implemented Java 1.4 logging api. Now the application hangs after writing a few info lines to a FileHandler log. It's clearly the logger that hangs because if I set log level = OFF the the program runs just fine.
    Has anyone seen anything similar?
    * To make it harder to debug, the problem only occurs when starting the application from an applet.

    That might happen that spawn process generates lots of output.
    Runtime.getRuntime().exec() returns object of type java.lange.Process. That object provide access to the stdout and stderror of the newly created process. If those streams are not cleaned properly then process will hang as soon as OS buffers of those stdout and stderr streams get full.
    One way to work around it just read output from the process and throw it away. You can try using something like this:
    package com.xxx;
    import java.io.InputStream;
    public class ProcessOutputWaster {
        public ProcessOutputWaster(Process process)
            throws Exception {
            createWorker(process.getErrorStream()).start();
            createWorker(process.getInputStream()).start();
        protected Worker createWorker(InputStream is) {
            return new Worker(is);
        protected static class Worker
                  extends Thread {
            private InputStream inputStream_;
            public Worker(InputStream inputStream) {
                inputStream_ = inputStream;
            public void run() {
                if (getInputStream() != null) {
                    try {
                        byte[] buffer = new byte[1024];
                        int read;
                        while(true) {
                            read = inputStream_.read(buffer);
                            if (read < 0)
                               break;
                    catch(Exception ex) {
                        Handle the error some how. E.g. show the error box.
    Process process = Runtime.getRuntime().exec(strCommand);
    ProcessOutputWaster outputWaster = new ProcessOutputWaster(process);

  • Complete working code for Gmail POP3 & SMTP with SSL - Java mail API

    Finally, your code-hunt has come to an end!!!!
    I am presenting you the complete solution (with code) to send and retrieve you mails to & from GMAIL using SMTP and POP3 with SSL & Authenticaion enabled. [Even starters & newbies like me, can easy try, test & understand - But first download & add JAR's of Java Mail API & Java Activation Framework to Netbeans Library Manager]
    Download Java Mail API here
    http://java.sun.com/products/javamail/
    Read Java Mail FAQ's here
    http://java.sun.com/products/javamail/FAQ.html
    Download Java Activation Framework [JAF]
    http://java.sun.com/products/javabeans/jaf/downloads/index.html
    Also, The POP program retrieves the mail sent with SMTP program :) [MOST IMPORTANT & LARGELY IN DEMAND]okey.. first things first... all of your thanks goes to the following and not a s@!te to me :)
    hail Java !!
    hail Java mail API !!
    hail Java forums !!
    hail Java-tips.org !!
    hail Netbeans !!
    Thanks to all coders who helped me by getting the code to work in one piece.
    special thanks to "bshannon" - The dude who runs this forum from 97!!I am just as happy as you will be when you execute the below code!! [my 13 hours of tweaking & code hunting has paid off!!]
    Now here it is...I only present you the complete solution!!
    START OF PROGRAM 1
    SENDING A MAIL FROM GMAIL ACCOUNT USING SMTP [STARTTLS (SSL)] PROTOCOL OF JAVA MAIL APINote on Program 1:
    1. In the code below replace USERNAME & PASSWORD with your respective GMAIL account username and its corresponding password!
    2. Use the code to make your Gmail client [jsp/servlets whatever]
    //Mail.java - smtp sending starttls (ssl) authentication enabled
    //1.Open a new Java class in netbeans (default package of the project) and name it as "Mail.java"
    //2.Copy paste the entire code below and save it.
    //3.Right click on the file name in the left side panel and click "compile" then click "Run"
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    public class Main
        String  d_email = "[email protected]",
                d_password = "PASSWORD",
                d_host = "smtp.gmail.com",
                d_port  = "465",
                m_to = "[email protected]",
                m_subject = "Testing",
                m_text = "Hey, this is the testing email.";
        public Main()
            Properties props = new Properties();
            props.put("mail.smtp.user", d_email);
            props.put("mail.smtp.host", d_host);
            props.put("mail.smtp.port", d_port);
            props.put("mail.smtp.starttls.enable","true");
            props.put("mail.smtp.auth", "true");
            //props.put("mail.smtp.debug", "true");
            props.put("mail.smtp.socketFactory.port", d_port);
            props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
            props.put("mail.smtp.socketFactory.fallback", "false");
            SecurityManager security = System.getSecurityManager();
            try
                Authenticator auth = new SMTPAuthenticator();
                Session session = Session.getInstance(props, auth);
                //session.setDebug(true);
                MimeMessage msg = new MimeMessage(session);
                msg.setText(m_text);
                msg.setSubject(m_subject);
                msg.setFrom(new InternetAddress(d_email));
                msg.addRecipient(Message.RecipientType.TO, new InternetAddress(m_to));
                Transport.send(msg);
            catch (Exception mex)
                mex.printStackTrace();
        public static void main(String[] args)
            Main blah = new Main();
        private class SMTPAuthenticator extends javax.mail.Authenticator
            public PasswordAuthentication getPasswordAuthentication()
                return new PasswordAuthentication(d_email, d_password);
    END OF PROGRAM 1-----
    START OF PROGRAM 2
    RETRIVE ALL THE MAILS FROM GMAIL INBOX USING Post Office Protocol POP3 [SSL] PROTOCOL OF JAVA MAIL APINote:
    1.Log into your gmail account via webmail [http://mail.google.com/]
    2.Click on "settings" and select "Mail Forwarding & POP3/IMAP"
    3.Select "enable POP for all mail" and "save changes"
    4.In the code below replace USERNAME & PASSWORD with your respective GMAIL account username and its corresponding password!
    PROGRAM 2 - PART 1 - Main.java
    //1.Open a new Java class file in the default package
    //2.Copy paste the below code and rename it to Mail.java
    //3.Compile and execute this code.
    public class Main {
        /** Creates a new instance of Main */
        public Main() {
         * @param args the command line arguments
        public static void main(String[] args) {
            try {
                GmailUtilities gmail = new GmailUtilities();
                gmail.setUserPass("[email protected]", "PASSWORD");
                gmail.connect();
                gmail.openFolder("INBOX");
                int totalMessages = gmail.getMessageCount();
                int newMessages = gmail.getNewMessageCount();
                System.out.println("Total messages = " + totalMessages);
                System.out.println("New messages = " + newMessages);
                System.out.println("-------------------------------");
    //Uncomment the below line to print the body of the message. Remember it will eat-up your bandwidth if you have 100's of messages.            //gmail.printAllMessageEnvelopes();
                gmail.printAllMessages();
            } catch(Exception e) {
                e.printStackTrace();
                System.exit(-1);
    END OF PART 1
    PROGRAM 2 - PART 2 - GmailUtilities.java
    //1.Open a new Java class in the project (default package)
    //2.Copy paste the below code
    //3.Compile - Don't execute this[Run]
    import com.sun.mail.pop3.POP3SSLStore;
    import java.io.File;
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.Date;
    import java.util.Properties;
    import javax.mail.Address;
    import javax.mail.FetchProfile;
    import javax.mail.Flags;
    import javax.mail.Folder;
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.Multipart;
    import javax.mail.Part;
    import javax.mail.Session;
    import javax.mail.Store;
    import javax.mail.URLName;
    import javax.mail.internet.ContentType;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeBodyPart;
    import javax.mail.internet.ParseException;
    public class GmailUtilities {
        private Session session = null;
        private Store store = null;
        private String username, password;
        private Folder folder;
        public GmailUtilities() {
        public void setUserPass(String username, String password) {
            this.username = username;
            this.password = password;
        public void connect() throws Exception {
            String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
            Properties pop3Props = new Properties();
            pop3Props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);
            pop3Props.setProperty("mail.pop3.socketFactory.fallback", "false");
            pop3Props.setProperty("mail.pop3.port",  "995");
            pop3Props.setProperty("mail.pop3.socketFactory.port", "995");
            URLName url = new URLName("pop3", "pop.gmail.com", 995, "",
                    username, password);
            session = Session.getInstance(pop3Props, null);
            store = new POP3SSLStore(session, url);
            store.connect();
        public void openFolder(String folderName) throws Exception {
            // Open the Folder
            folder = store.getDefaultFolder();
            folder = folder.getFolder(folderName);
            if (folder == null) {
                throw new Exception("Invalid folder");
            // try to open read/write and if that fails try read-only
            try {
                folder.open(Folder.READ_WRITE);
            } catch (MessagingException ex) {
                folder.open(Folder.READ_ONLY);
        public void closeFolder() throws Exception {
            folder.close(false);
        public int getMessageCount() throws Exception {
            return folder.getMessageCount();
        public int getNewMessageCount() throws Exception {
            return folder.getNewMessageCount();
        public void disconnect() throws Exception {
            store.close();
        public void printMessage(int messageNo) throws Exception {
            System.out.println("Getting message number: " + messageNo);
            Message m = null;
            try {
                m = folder.getMessage(messageNo);
                dumpPart(m);
            } catch (IndexOutOfBoundsException iex) {
                System.out.println("Message number out of range");
        public void printAllMessageEnvelopes() throws Exception {
            // Attributes & Flags for all messages ..
            Message[] msgs = folder.getMessages();
            // Use a suitable FetchProfile
            FetchProfile fp = new FetchProfile();
            fp.add(FetchProfile.Item.ENVELOPE);       
            folder.fetch(msgs, fp);
            for (int i = 0; i < msgs.length; i++) {
                System.out.println("--------------------------");
                System.out.println("MESSAGE #" + (i + 1) + ":");
                dumpEnvelope(msgs);
    public void printAllMessages() throws Exception {
    // Attributes & Flags for all messages ..
    Message[] msgs = folder.getMessages();
    // Use a suitable FetchProfile
    FetchProfile fp = new FetchProfile();
    fp.add(FetchProfile.Item.ENVELOPE);
    folder.fetch(msgs, fp);
    for (int i = 0; i < msgs.length; i++) {
    System.out.println("--------------------------");
    System.out.println("MESSAGE #" + (i + 1) + ":");
    dumpPart(msgs[i]);
    public static void dumpPart(Part p) throws Exception {
    if (p instanceof Message)
    dumpEnvelope((Message)p);
    String ct = p.getContentType();
    try {
    pr("CONTENT-TYPE: " + (new ContentType(ct)).toString());
    } catch (ParseException pex) {
    pr("BAD CONTENT-TYPE: " + ct);
    * Using isMimeType to determine the content type avoids
    * fetching the actual content data until we need it.
    if (p.isMimeType("text/plain")) {
    pr("This is plain text");
    pr("---------------------------");
    System.out.println((String)p.getContent());
    } else {
    // just a separator
    pr("---------------------------");
    public static void dumpEnvelope(Message m) throws Exception {       
    pr(" ");
    Address[] a;
    // FROM
    if ((a = m.getFrom()) != null) {
    for (int j = 0; j < a.length; j++)
    pr("FROM: " + a[j].toString());
    // TO
    if ((a = m.getRecipients(Message.RecipientType.TO)) != null) {
    for (int j = 0; j < a.length; j++) {
    pr("TO: " + a[j].toString());
    // SUBJECT
    pr("SUBJECT: " + m.getSubject());
    // DATE
    Date d = m.getSentDate();
    pr("SendDate: " +
    (d != null ? d.toString() : "UNKNOWN"));
    static String indentStr = " ";
    static int level = 0;
    * Print a, possibly indented, string.
    public static void pr(String s) {
    System.out.print(indentStr.substring(0, level * 2));
    System.out.println(s);
    }END OF PART 2
    END OF PROGRAM 2
    P.S: CHECKING !!
    STEP 1.
    First compile and execute the PROGRAM 1 with your USERNAME & PASSWORD. This will send a mail to your own account.
    STEP 2.
    Now compile both PART 1 & PART 2 of PROGRAM 2. Then, execute PART 1 - Main.java. This will retrive the mail sent in step 1. njoy! :)
    In future, I hope this is added to the demo programs of the Java Mail API download package.
    This is for 3 main reasons...
    1. To prevent a lot of silly questions being posted on this forum [like the ones I did :(].
    2. To give the first time Java Mail user with a real time working example without code modification [code has to use command line args like the demo programs - for instant results].
    3. Also, this is what google has to say..
    "The Gmail Team is committed to making sure you always can access your mail. That's why we're offering POP access and auto-forwarding. Both features are free for all Gmail users and we have no plans to charge for them in the future."
    http://mail.google.com/support/bin/answer.py?answer=13295
    I guess bshannon & Java Mail team is hearing this....
    Again, Hurray and thanks for helping me make it!! cheers & no more frowned faces!!
    (: (: (: (: (: GO JCODERS GO!! :) :) :) :) :)
    codeace
    -----                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    Thanks for the reply,
    I did checked by enabling session debuging and also checked pop settings it's enabled for all
    mails, I tried deleting some very old messages and now the message count is changed to 310.
    This may be the problem with gmail.
    Bellow is the output i got,
    DEBUG: setDebug: JavaMail version 1.4ea
    DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]
    DEBUG POP3: connecting to host "pop.gmail.com", port 995, isSSL false
    S: +OK Gpop ready for requests from 121.243.255.240 n22pf5432603pof.2
    C: USER [email protected]
    S: +OK send PASS
    C: PASS my_password
    S: +OK Welcome.
    C: STAT
    S: +OK 310 26900234
    Custom output: messageCount : 310
    C: QUIT
    S: +OK Farewell.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to set NC Log API

    Hi all,
    I want to use the following NC log API,but I don't know how to initialize the interface's java object and set the parameter "ApplicationVO".
    Interface LogNCApplicationInterface
    Method ApplicationVO addNDone(ApplicationVO applicationvo)
    Please help me.Thank you!
    Qiang Liu

    if you just need to log an NC the minimum fields you need to set are the following:
    CreateNCRequest ncRequest = new CreateNCRequest();
    ncRequest.setActivity("NC500"); // activity where NC is logged - can be any name
    ncRequest.setSfcRef(new SFCBOHandle(site, sfcParent).toString());// the SFC for which you are reporting an NC
    // ncRequest.setValidateNCCodeOperation(true); // no need to set it, it's true by default
    // nc code reference for nc code that is reported
    // nc code must exist in the system
    ncRequest.setNcCodeRef(new NCCodeBOHandle(site,"NCCODE").toString());
    // required custom fields must be set
    CreateNCResponse ncResponse = ncPSI.createNC(ncRequest);

  • Setting Logging API config file

    Hi,
    Is there a way I can set the Logging API's config file (java.util.logging.config.file) from within my program? I have tried using System.setProperty but it doesn't seem to work. The only way I seem to be able to set the property is with -D on the command line.
    Thanks
    Rob

    Is there a way I can set the Logging API's config file (java.util.logging.config.file) from within my program? I have tried using System.setProperty but it doesn't seem to work. The only way I seem to be able to set the property is with -D on the command line.Read the Logging Overview Dokumentation
    anyway
    InputStream inputStream = new FileInputStream("logging.properties");
    LogManager.getLogManager().readConfiguration(inputStream);
    ...

  • Is this logging code faster than using a standard logging API like log4J

    is this logging code faster than using a standard logging API like log4J or the logging API in java 1.4
    As you can see my needs are extremely simple. write some stuff to text file and write some stuff to dos window.
    I am thinking about using this with a multi threaded app. So all the threads ~ 200 will be using this simultaneously.
    * Tracer.class logs items according to the following criteria:
    * 2 = goes to text file Crawler_log.txt
    * 1 = goes to console window because it is higher priority.
    * @author Stephen
    * @version 1.0
    * @since June 2002
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.text.*;
    class Tracer{
    public static void log(int traceLevel, String message, Object value)
    if(traceLevel == 1){
    System.out.println(getLogFileDate(new Date()) +" >" + message+ " value = " + value.toString()););
    }else{
    pout.write(getLogFileDate(new Date()) +" >" + message + " value = " + value.toString());
    pout.flush();
    public static void log(int traceLevel, String message )
    if(traceLevel == 1){System.out.println(message);
    }else{
    pout.write(message ) ;
    pout.flush();
    //public static accessor method
    public static Tracer getTracerInstance()
    return tracerInstance;
    private static String getLogFileDate(Date d )
    String s = df.format(d);
    String s1= s.replace(',','-');
    String s2= s1.replace(' ','-');
    String s3= s2.replace(':','.');
    System.out.println("getLogFileDate() = " + s3 ) ;
    return s3;
    //private instance
    private Tracer(){
    System.out.println("Tracer constructor works");
    df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
    date = new java.util.Date();
    try{
    pout = new PrintWriter(new BufferedWriter(new FileWriter("Crawler_log"+getLogFileDate(new Date())+".txt", true)));
    pout.write("**************** New Log File Created "+ getLogFileDate(new Date()) +"****************");
    pout.flush();
    }catch (IOException e){
    System.out.println("**********THERE WAS A CRITICAL ERROR GETTING TRACER SINGLETON INITIALIZED. APPLICATION WILL STOP EXECUTION. ******* ");
    public static void main(String[] argz){
    System.out.println("main method starts ");
    Tracer tt = Tracer.getTracerInstance();
    System.out.println("main method successfully gets Tracer instance tt. "+ tt.toString());
    //the next method is where it fails - on pout.write() of log method. Why ?
    tt.log(1, "HIGH PRIORITY");
    System.out.println("main method ends ");
    //private static reference
    private static Tracer tracerInstance = new Tracer();
    private static Date date = null;
    private static PrintWriter pout = null;
    public static DateFormat df = null;
    }

    In general I'd guess that a small, custom thing will be faster than a large, generic thing with a lot of options. That is, unless the writer of the small program have done something stupid, og the writer of the large program have done something very smart.
    One problem with java in this respect is that it is next to impossible to judge exactly how much machine-level processing a single java statement takes. Things like JIT compilers makes it even harder.
    In the end, there is really only one way to find out: Test it.

Maybe you are looking for

  • How to get input text values from adf table - Urgent

    Hi Friends, This is my requirement. I designed customized master - detail - detail page. I customized the page in below format. 1. Master Data Field (Input text,etc) . 2. Detail in table format ( Rows are mapped to child table) and i given two button

  • Interview  Questions. Help me to get the answers

    Hi, The interview questions are, 1) Oracle installation under Unix and WindowsNT? Differences 2) Difference between UTLXPLP.SQL and UTLXPLS.SQL 3) If Database size is 1TB can the SGA size be 1024MB 4) Can we take logical backup? How 5) If we update a

  • Corrupted iTunes folder within iPod_Control--What to Do?

    i posted this same question in another part of the website, but i think i might have better luck here I'm the owner of and ipod mini. About 2 months ago my ipod ran into a series of problems which lead to a persistent folder appearing with an exclama

  • Ipod unable to be restored

    Ok I can't restore my ipod it says Theipod software update serve could not be contacted. Make sure your network settings are correct and your network connection is active or try again later. I don't know it's saying that because nothing is wrong with

  • Adobe programs will not run.

    We keep having a recurring problem were adobe products fail to run. The issue is occurring to frequently continue reinstalling the Adobe suite whenever it happens. As an example, when you run illustrator the illustrator.exe and pdapp.exe processes st