
Hi Ceki, It looks like my StringBuilder is the one that screws things up not the Logback. I'm appending strings using StringBuilder sb = new StringBuilder(800) then later (in the code) I have: sb.append("someStrings"); finally I have rfa.doAppend(sb); where rfa is the RollingFileAppender (just to clarify) Anyway I have to solve this..... maybe it'll be better to use StringBuffer. (StringBuffer and StringBuilder is almost identical though.... ) Hm.... Intriguing.... Thanks for your quick replies. Greg. On Wed, Oct 29, 2008 at 1:25 PM, Ceki Gulcu <listid@qos.ch> wrote:
Hello Greg,
Have you tried using a logger instead of logging directly through the RollingFileAppender instance? What is the rollover frequency?
By the way, it would be very helpful if you could create a jira issue (http://jira.qos.ch) attaching code reproducing the problem.
Greg Flex wrote:
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@qos.ch> wrote:
Hello Greg,
Please see
http://logback.qos.ch/xref-test/ch/qos/logback/core/rolling/TimeBasedRolling...
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@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@qos.ch http://qos.ch/mailman/listinfo/logback-user
------------------------------------------------------------------------
_______________________________________________ Logback-user mailing list Logback-user@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@qos.ch http://qos.ch/mailman/listinfo/logback-user