[logback-user] Flushing problem
Harish Krishnaswamy
harishkswamy at gmail.com
Fri Feb 6 07:25:37 CET 2009
This is one of the weirdest problems I have seen :) Your test files worked
fine as-is, so I modified it to closely resemble the original codebase and
it still worked, so I went back to playing with the original codebase and
all of sudden after midnight it started working and it still works now with
the original code after backing out all my patches for this problem. One
thing I noticed though - the code is running a bit slower now than it was
this morning, probably due to another process on the box, but I still can't
explain the behavior. I will have to see what happens tomorrow :) But,
thanks again for your help.
-Harish
2009/2/5 Ceki Gulcu <ceki at qos.ch>
>
> I have ran HarishMain application using the logback.xml included in the
> attachments. I am seeing all messages as expected. Could you please run the
> tests on your side and see if it works for you?
>
>
> Harish Krishnaswamy wrote:
>
>> Hi Ceki,
>>
>> I am using the RollingFileAppender and the SMTPAppender. And actually I
>> get the email but its just not going to the file which makes me believe that
>> its just not getting flushed. I am listing the shutdown task and the logback
>> config. I appreciate the help!
>>
>
> --
> Ceki Gülcü
> Logback: The reliable, generic, fast and flexible logging framework for
> Java.
> http://logback.qos.ch
>
> package ch.qos.logback.classic;
>
> import java.net.InetAddress;
> import java.net.UnknownHostException;
>
> import org.slf4j.LoggerFactory;
>
> public class HarishMain {
>
> public static void main(String[] args) throws InterruptedException {
>
> org.slf4j.Logger logger = LoggerFactory.getLogger(HarishMain.class);
> logger.info("Harish");
> Thread.sleep(3000);
> Runtime runtime = Runtime.getRuntime();
> runtime.addShutdownHook(new Thread(new HarishRunnable()));
> }
>
> static class HarishRunnable implements Runnable {
> org.slf4j.Logger _logger = LoggerFactory.getLogger(this.getClass());
>
> public void run() {
> _logger.info("Importer shutting down...");
>
> org.slf4j.Logger emailLogger = LoggerFactory.getLogger("email");
> emailLogger.info("status");
>
> String hostName = null;
>
> try {
> hostName = InetAddress.getLocalHost().getHostName();
> } catch (UnknownHostException e) {
> hostName = "Unknown host";
> }
>
> emailLogger.error(System.getProperty("user.name") + " - " +
> hostName);
>
> _logger.info("Importer shutdown complete.");
>
> LoggerContext lCtx = (LoggerContext)
> LoggerFactory.getILoggerFactory();
> lCtx.stop();
> }
> }
>
> }
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/logback-user/attachments/20090206/151f84ee/attachment.htm>
More information about the Logback-user
mailing list