[logback-user] RollingFileAppender

Greg Flex greg.flex at gmail.com
Wed Oct 29 21:03:10 CET 2008


Thanks Ceki,
I used example6 and it works but when loading (as many as possible) logs
with Strings
 I'm getting: " Exception in thread "main" java.lang.OutOfMemoryError: Java
heap space ".
I have a loop that simply loads using:  rfa.doAppend(someString); about 70
000 times.
(the same string over and over again, which is about 3.4KB an XML formatted
String)
How do I prevent it from getting the above stated Exception.
Thanks
Greg.



On Wed, Oct 29, 2008 at 2:07 AM, Ceki Gulcu <listid at qos.ch> wrote:

>
> Hello Greg,
>
> Please see
>
>
> http://logback.qos.ch/xref-test/ch/qos/logback/core/rolling/TimeBasedRollingTest.html
>
> for an example. You just need to replace
>
>  RollingFileAppender<Object> rfa = new RollingFileAppender<Object>();
>
> with
>
>  RollingFileAppender<LoggingEvent> rfa =
>                            new RollingFileAppender<LoggingEvent>();
>
> and the layout variable should be of type PattenLayout (assuming that's the
> layout type you wish to use).
>
> HTH,
>
> Greg Flex wrote:
> > Hi All,
> > Could someone please post a simple example on how to use the
> > RollingFileAppender programmatically?
> > I'm having problems figuring this out. (and massages such as: No context
> > given.... etc.)
> > Basically what I'd like to do is set everything in my java program.
> > Write to a file but adding stuff like computer's IP address and its name
> > etc.
> > Most importantly, I'd like to modify the file name itself. Say in the
> > format: IP_address_date {yyyy-MM-dd_HH-mm-ss}.log
> > Thanks a lot,
> > Greg.
> >
> >
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Logback-user mailing list
> > Logback-user at qos.ch
> > http://qos.ch/mailman/listinfo/logback-user
>
> --
> Ceki Gülcü
> Logback: The reliable, generic, fast and flexible logging framework for
> Java.
> http://logback.qos.ch
> _______________________________________________
> 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/20081029/b771479e/attachment-0001.htm 


More information about the Logback-user mailing list