Hi Ceki,<br>It looks like my StringBuilder is the one that screws things up not the Logback.<br>I'm appending strings using StringBuilder sb = new StringBuilder(800)<br>then later (in the code) I have: sb.append("someStrings");<br>
finally I have rfa.doAppend(sb); where rfa is the RollingFileAppender (just to clarify)<br>Anyway I have to solve this..... maybe it'll be better to use StringBuffer. <br>(StringBuffer and StringBuilder is almost identical though.... )<br>
Hm.... Intriguing.... <br>Thanks for your quick replies.<br>Greg.<br> <br><br><div class="gmail_quote">On Wed, Oct 29, 2008 at 1:25 PM, Ceki Gulcu <span dir="ltr"><listid@qos.ch></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello Greg,<br>
<br>
Have you tried using a logger instead of logging directly through the<br>
RollingFileAppender instance? What is the rollover frequency?<br>
<br>
By the way, it would be very helpful if you could create a jira issue<br>
(<a href="http://jira.qos.ch" target="_blank">http://jira.qos.ch</a>) attaching code reproducing the problem.<br>
<div><div></div><div class="Wj3C7c"><br>
Greg Flex wrote:<br>
> Thanks Ceki,<br>
> I used example6 and it works but when loading (as many as possible) logs<br>
> with Strings<br>
> I'm getting: " Exception in thread "main" java.lang.OutOfMemoryError:<br>
> Java heap space ".<br>
> I have a loop that simply loads using: rfa.doAppend(someString); about<br>
> 70 000 times.<br>
> (the same string over and over again, which is about 3.4KB an XML<br>
> formatted String)<br>
> How do I prevent it from getting the above stated Exception.<br>
> Thanks<br>
> Greg.<br>
><br>
><br>
><br>
> On Wed, Oct 29, 2008 at 2:07 AM, Ceki Gulcu <listid@qos.ch> wrote:<br>
><br>
><br>
> Hello Greg,<br>
><br>
> Please see<br>
><br>
> <a href="http://logback.qos.ch/xref-test/ch/qos/logback/core/rolling/TimeBasedRollingTest.html" target="_blank">http://logback.qos.ch/xref-test/ch/qos/logback/core/rolling/TimeBasedRollingTest.html</a><br>
><br>
> for an example. You just need to replace<br>
><br>
> RollingFileAppender<Object> rfa = new RollingFileAppender<Object>();<br>
><br>
> with<br>
><br>
> RollingFileAppender<LoggingEvent> rfa =<br>
> new RollingFileAppender<LoggingEvent>();<br>
><br>
> and the layout variable should be of type PattenLayout (assuming<br>
> that's the<br>
> layout type you wish to use).<br>
><br>
> HTH,<br>
><br>
> Greg Flex wrote:<br>
> > Hi All,<br>
> > Could someone please post a simple example on how to use the<br>
> > RollingFileAppender programmatically?<br>
> > I'm having problems figuring this out. (and massages such as: No<br>
> context<br>
> > given.... etc.)<br>
> > Basically what I'd like to do is set everything in my java program.<br>
> > Write to a file but adding stuff like computer's IP address and<br>
> its name<br>
> > etc.<br>
> > Most importantly, I'd like to modify the file name itself. Say in the<br>
> > format: IP_address_date {yyyy-MM-dd_HH-mm-ss}.log<br>
> > Thanks a lot,<br>
> > Greg.<br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> ------------------------------------------------------------------------<br>
> ><br>
> > _______________________________________________<br>
> > Logback-user mailing list<br>
> > Logback-user@qos.ch<br>
> > <a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br>
><br>
> --<br>
> Ceki Gülcü<br>
> Logback: The reliable, generic, fast and flexible logging framework<br>
> for Java.<br>
> <a href="http://logback.qos.ch" target="_blank">http://logback.qos.ch</a><br>
> _______________________________________________<br>
> Logback-user mailing list<br>
> Logback-user@qos.ch<br>
> <a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br>
><br>
><br>
><br>
> ------------------------------------------------------------------------<br>
><br>
> _______________________________________________<br>
> Logback-user mailing list<br>
> Logback-user@qos.ch<br>
> <a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br>
<br>
--<br>
Ceki Gülcü<br>
Logback: The reliable, generic, fast and flexible logging framework for Java.<br>
<a href="http://logback.qos.ch" target="_blank">http://logback.qos.ch</a><br>
_______________________________________________<br>
Logback-user mailing list<br>
Logback-user@qos.ch<br>
<a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br>
</div></div></blockquote></div><br>