From toad at amphibian.dyndns.org Mon Dec 3 15:39:44 2007 From: toad at amphibian.dyndns.org (Matthew Toseland) Date: Mon, 3 Dec 2007 15:39:44 +0000 Subject: [Freemail] r15929 - in trunk/apps/Freemail/src/freemail: . utils In-Reply-To: <20071122202444.63CA647AA81@freenetproject.org> References: <20071122202444.63CA647AA81@freenetproject.org> Message-ID: <200712031539.49032.toad@amphibian.dyndns.org> These should be a single Logger.normal() call. Even if you have to include \n's in them, it's better for them to be atomic, especially if you're running with the node's logger later on. It's quite possible to configure freenet's logger to log to stderr etc. The only problem is providing the classes when running in standalone mode. We could perhaps provide a jar with the parts of freenet/support/ that don't depend on the node core... On Thursday 22 November 2007 20:24, alexlehm at freenetproject.org wrote: > Author: alexlehm > Date: 2007-11-22 20:24:44 +0000 (Thu, 22 Nov 2007) > New Revision: 15929 > > Added: > trunk/apps/Freemail/src/freemail/utils/Logger.java > Modified: > trunk/apps/Freemail/src/freemail/InboundContact.java > trunk/apps/Freemail/src/freemail/OutboundContact.java > trunk/apps/Freemail/src/freemail/RTSFetcher.java > Log: > Logger class for Freemail, this tries to mimic the Logger class form Freenet, maybe we can later exchange the class by simple changing the import. The logging has to be changed on a few other classes as well, I'll commit that later. > A regular user will need normal and error messages, anything minor is status logs that do not show progress (e.g. checking message keys). > > Modified: trunk/apps/Freemail/src/freemail/InboundContact.java > =================================================================== > if(slot.length()!=52) { > - System.out.println("ignoring malformed slot "+slot+" (probably due to previous bug)"); > - System.out.println("please the fix the entry in "+this.ibct_dir); > + Logger.normal(this,"ignoring malformed slot "+slot+" (probably due to previous bug)"); > + Logger.normal(this,"please the fix the entry in "+this.ibct_dir); > break; > } -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://emu.freenetproject.org/pipermail/freemail/attachments/20071203/b237097c/attachment.pgp From alexlehm at myrealbox.com Wed Dec 5 20:50:57 2007 From: alexlehm at myrealbox.com (Alexander Lehmann) Date: Wed, 05 Dec 2007 21:50:57 +0100 Subject: [Freemail] r15929 - in trunk/apps/Freemail/src/freemail: . utils Message-ID: <47570F31.7020300@myrealbox.com> I think the logger depends on l10n in some way, so I'm not sure if this makes sense. You can use the complete freenet.jar to run Freemail, this would only require a bat/sh file to start it. > Message: 1 > Date: Mon, 3 Dec 2007 15:39:44 +0000 > From: Matthew Toseland > Subject: Re: [Freemail] r15929 - in trunk/apps/Freemail/src/freemail: > . utils > To: freemail at freenetproject.org > Message-ID: <200712031539.49032.toad at amphibian.dyndns.org> > Content-Type: text/plain; charset="iso-8859-1" > > These should be a single Logger.normal() call. Even if you have to include > \n's in them, it's better for them to be atomic, especially if you're running > with the node's logger later on. > > It's quite possible to configure freenet's logger to log to stderr etc. The > only problem is providing the classes when running in standalone mode. We > could perhaps provide a jar with the parts of freenet/support/ that don't > depend on the node core... > > On Thursday 22 November 2007 20:24, alexlehm at freenetproject.org wrote: > > Author: alexlehm > > Date: 2007-11-22 20:24:44 +0000 (Thu, 22 Nov 2007) > > New Revision: 15929 > > > > Added: > > trunk/apps/Freemail/src/freemail/utils/Logger.java > > Modified: > > trunk/apps/Freemail/src/freemail/InboundContact.java > > trunk/apps/Freemail/src/freemail/OutboundContact.java > > trunk/apps/Freemail/src/freemail/RTSFetcher.java > > Log: > > Logger class for Freemail, this tries to mimic the Logger class form > Freenet, maybe we can later exchange the class by simple changing the import. > The logging has to be changed on a few other classes as well, I'll commit > that later. > > A regular user will need normal and error messages, anything minor is status > logs that do not show progress (e.g. checking message keys). > > > > Modified: trunk/apps/Freemail/src/freemail/InboundContact.java > > =================================================================== > > if(slot.length()!=52) { > > - System.out.println("ignoring malformed slot "+slot+" (probably due to > previous bug)"); > > - System.out.println("please the fix the entry in "+this.ibct_dir); > > + Logger.normal(this,"ignoring malformed slot "+slot+" (probably due to > previous bug)"); > > + Logger.normal(this,"please the fix the entry in "+this.ibct_dir); > > break; > > } > From dbkr at freenetproject.org Wed Dec 5 21:59:22 2007 From: dbkr at freenetproject.org (Dave Baker) Date: Wed, 5 Dec 2007 21:59:22 +0000 Subject: [Freemail] r15929 - in trunk/apps/Freemail/src/freemail: . utils In-Reply-To: <47570F31.7020300@myrealbox.com> References: <47570F31.7020300@myrealbox.com> Message-ID: <200712052159.22949.dbkr@freenetproject.org> Well, we will want l10n at some point! There's certainly an argument for making a freenet-common.jar or something to share common code around the freenet project. We use other stuff from the freenet jar, and it's a bit inelegant and wasteful fetching the whole jar at compilation. There's a chance a might get to look at doing this, although fixing Freemail bugs has to be higher up the priority list. Dave On Wednesday 05 December 2007 20:50:57 Alexander Lehmann wrote: > I think the logger depends on l10n in some way, so I'm not sure if this makes sense. You can use the complete freenet.jar to run Freemail, this would only require a bat/sh file to start it. > > > Message: 1 > > Date: Mon, 3 Dec 2007 15:39:44 +0000 > > From: Matthew Toseland > > Subject: Re: [Freemail] r15929 - in trunk/apps/Freemail/src/freemail: > > . utils > > To: freemail at freenetproject.org > > Message-ID: <200712031539.49032.toad at amphibian.dyndns.org> > > Content-Type: text/plain; charset="iso-8859-1" > > > > These should be a single Logger.normal() call. Even if you have to include > > \n's in them, it's better for them to be atomic, especially if you're running > > with the node's logger later on. > > > > It's quite possible to configure freenet's logger to log to stderr etc. The > > only problem is providing the classes when running in standalone mode. We > > could perhaps provide a jar with the parts of freenet/support/ that don't > > depend on the node core... > > > > On Thursday 22 November 2007 20:24, alexlehm at freenetproject.org wrote: > > > Author: alexlehm > > > Date: 2007-11-22 20:24:44 +0000 (Thu, 22 Nov 2007) > > > New Revision: 15929 > > > > > > Added: > > > trunk/apps/Freemail/src/freemail/utils/Logger.java > > > Modified: > > > trunk/apps/Freemail/src/freemail/InboundContact.java > > > trunk/apps/Freemail/src/freemail/OutboundContact.java > > > trunk/apps/Freemail/src/freemail/RTSFetcher.java > > > Log: > > > Logger class for Freemail, this tries to mimic the Logger class form > > Freenet, maybe we can later exchange the class by simple changing the import. > > The logging has to be changed on a few other classes as well, I'll commit > > that later. > > > A regular user will need normal and error messages, anything minor is status > > logs that do not show progress (e.g. checking message keys). > > > > > > Modified: trunk/apps/Freemail/src/freemail/InboundContact.java > > > =================================================================== > > > if(slot.length()!=52) { > > > - System.out.println("ignoring malformed slot "+slot+" (probably due to > > previous bug)"); > > > - System.out.println("please the fix the entry in "+this.ibct_dir); > > > + Logger.normal(this,"ignoring malformed slot "+slot+" (probably due to > > previous bug)"); > > > + Logger.normal(this,"please the fix the entry in "+this.ibct_dir); > > > break; > > > } > > > > > _______________________________________________ > Freemail mailing list > Freemail at freenetproject.org > http://emu.freenetproject.org/cgi-bin/mailman/listinfo/freemail > From alexlehm at freenetproject.org Thu Dec 6 21:59:03 2007 From: alexlehm at freenetproject.org (alexlehm at freenetproject.org) Date: Thu, 6 Dec 2007 21:59:03 +0000 (UTC) Subject: [Freemail] r16375 - in trunk/apps/Freemail/src/freemail: . utils Message-ID: <20071206215903.48795480F0F@freenetproject.org> Author: alexlehm Date: 2007-12-06 21:59:03 +0000 (Thu, 06 Dec 2007) New Revision: 16375 Modified: trunk/apps/Freemail/src/freemail/InboundContact.java trunk/apps/Freemail/src/freemail/utils/Logger.java Log: improved Logger class to use the one from Freenet if available (e.g. running as plugin) or log to stdout if not. This should work as long as we do not use the freenet logger class directly. Modified: trunk/apps/Freemail/src/freemail/InboundContact.java =================================================================== --- trunk/apps/Freemail/src/freemail/InboundContact.java 2007-12-06 21:47:50 UTC (rev 16374) +++ trunk/apps/Freemail/src/freemail/InboundContact.java 2007-12-06 21:59:03 UTC (rev 16375) @@ -95,8 +95,7 @@ // a fix for the bug causing this (https://bugs.freenetproject.org/view.php?id=1087) was committed on Feb 4 2007, // anybody who has started using Freemail after that date is not affected. if(slot.length()!=52) { - Logger.normal(this,"ignoring malformed slot "+slot+" (probably due to previous bug)"); - Logger.normal(this,"please the fix the entry in "+this.ibct_dir); + Logger.normal(this,"Ignoring malformed slot "+slot+" (probably due to previous bug). Please the fix the entry in "+this.ibct_dir); break; } String key = basekey+slot; Modified: trunk/apps/Freemail/src/freemail/utils/Logger.java =================================================================== --- trunk/apps/Freemail/src/freemail/utils/Logger.java 2007-12-06 21:47:50 UTC (rev 16374) +++ trunk/apps/Freemail/src/freemail/utils/Logger.java 2007-12-06 21:59:03 UTC (rev 16375) @@ -3,13 +3,14 @@ * * this is a first attempt at fixing the logging so that not everything * is written to stdout. This class attempts to mimic the Logger class - * from Freenet, later we can probably use the class from Freenet without - * changing much except the import statement. + * from Freenet and calls the Freenet Logger class is available. * */ package freemail.utils; +import java.lang.NoClassDefFoundError; + public class Logger { static final private int INTERNAL=1; @@ -18,10 +19,28 @@ static final private int NORMAL=8; static final private int ERROR=16; + static boolean initialized=false; + static boolean foundFreenetLogger=false; + //static final private int loglevel=INTERNAL|DEBUG|MINOR|NORMAL|ERROR; // everything //static final private int loglevel=DEBUG|NORMAL|ERROR; static final private int loglevel=NORMAL|ERROR; // should be ok for normal users + static private boolean useFreenetLogger() + { + if(!initialized) { + try { + freenet.support.Logger.shouldLog(0, null); + foundFreenetLogger=true; + } + catch(NoClassDefFoundError ex) { + foundFreenetLogger=false; + } + initialized=true; + } + return foundFreenetLogger; + } + static private void log(int l, Object o, String s, String level) { if((l&loglevel)!=0) { System.out.println(level+"("+o.getClass().getName()+"): "+s); @@ -35,35 +54,67 @@ } static public void minor(Object o, String s) { - log(MINOR,o,s,"MINOR"); + if(useFreenetLogger()) { + freenet.support.Logger.minor(o,s); + } else { + log(MINOR,o,s,"MINOR"); + } } static public void minor(Class c, String s) { - log(MINOR,c,s,"MINOR"); + if(useFreenetLogger()) { + freenet.support.Logger.minor(c,s); + } else { + log(MINOR,c,s,"MINOR"); + } } static public void normal(Object o, String s) { - log(NORMAL,o,s,"NORMAL"); + if(useFreenetLogger()) { + freenet.support.Logger.normal(o,s); + } else { + log(NORMAL,o,s,"NORMAL"); + } } static public void normal(Class c, String s) { - log(NORMAL,c,s,"NORMAL"); + if(useFreenetLogger()) { + freenet.support.Logger.normal(c,s); + } else { + log(NORMAL,c,s,"NORMAL"); + } } static public void error(Object o, String s) { - log(ERROR,o,s,"ERROR"); + if(useFreenetLogger()) { + freenet.support.Logger.error(o,s); + } else { + log(ERROR,o,s,"ERROR"); + } } static public void error(Class c, String s) { - log(ERROR,c,s,"ERROR"); + if(useFreenetLogger()) { + freenet.support.Logger.error(c,s); + } else { + log(ERROR,c,s,"ERROR"); + } } static public void debug(Object o, String s) { - log(DEBUG,o,s,"DEBUG"); + if(useFreenetLogger()) { + freenet.support.Logger.debug(o,s); + } else { + log(DEBUG,o,s,"DEBUG"); + } } static public void debug(Class c, String s) { - log(DEBUG,c,s,"DEBUG"); + if(useFreenetLogger()) { + freenet.support.Logger.debug(c,s); + } else { + log(DEBUG,c,s,"DEBUG"); + } } } From toad at amphibian.dyndns.org Fri Dec 7 18:47:17 2007 From: toad at amphibian.dyndns.org (Matthew Toseland) Date: Fri, 7 Dec 2007 18:47:17 +0000 Subject: [Freemail] Fwd: Undelivered Mail Returned to Sender Message-ID: <200712071847.22545.toad@amphibian.dyndns.org> alexlehm please let me know your current working email address so I can fix it. A requirement of access to SVN is that you have a working email address attached to your @freenetproject.org alias. -------------- next part -------------- An embedded message was scrubbed... From: MAILER-DAEMON at amphibian.dyndns.org (Mail Delivery System) Subject: Undelivered Mail Returned to Sender Date: Fri, 7 Dec 2007 17:34:26 +0000 (GMT) Size: 9347 Url: http://emu.freenetproject.org/pipermail/freemail/attachments/20071207/cb158dae/attachment.eml -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://emu.freenetproject.org/pipermail/freemail/attachments/20071207/cb158dae/attachment.pgp