Best practice is to use the logging system, using System.out.println() for logging is almost universally regarded as bad practice, many static analysis tools will automatically flag it as a problem.
The example you gave in NodeCrypto is not best practice, that should probably just be something like: Logger.error(this, "Could not use port: "+bindto+ ':'+portNo+": "+e, e) Freenet has it's own logging system (see here <https://github.com/freenet/fred/blob/088f5f479a2b8b83d813e8a77d8f2937ce9c27d1/src/freenet/support/Logger.java>), possibly because Freenet predates a lot of the logging frameworks, however we should probably be using one of the numerous logging libraries like Logback, as they are more flexible. Ian. On Sat, Dec 26, 2015 at 7:05 AM, Xiaoyu Huang <[email protected]> wrote: > System.out.println() is for easier debugging as I can see the results > directly in wrapper.log. > > I see many examples in Fred code that uses both Logger and println(). An > example in NodeCrypto.java line around 136: > > Logger.normal(this, "Could not use port: "+bindto+ ':' > +portNo+": "+e, e); > System.err.println("Could not use port: "+bindto+ ':' > +portNo+": "+e); > > I'm not quite sure what's the best practice. > > -- Xiaoyu > > On Sat, Dec 26, 2015 at 1:39 AM, Ian <[email protected]> wrote: > > > This looks great! > > > > I notice a lot of System.out.println()s in the code, do we not have a > > logging mechanism in Fred available for use by plugins? > > > > On Fri, Dec 25, 2015 at 10:14 AM, Xiaoyu Huang <[email protected]> wrote: > > > > > Hi All, > > > > > > As nextgens suggests, I write this plugin which is based on the newer > and > > > more stable UPnP lib named Cling (http://4thline.org/projects/cling/). > > > > > > Currently It only supports FredPluginIPDetector and > > FredPluginPortForward. > > > I will add FredPluginBandwidthIndicator and Web UI support when I have > > > time. > > > > > > Code review, suggestions and tests are required. The source code can be > > > accessed here: > > > > > > https://github.com/007pig/plugin-UPnP2 > > > > > > I uses Gradle as the build system. So to build the plugin and package > it > > as > > > plugin jar, you need: > > > > > > 1. Copy freenet.jar, freenet-ext.jar and bcprov-jdk15on-152.jar to > > > "[project root]/libs" dir. > > > 2. Run "./gradlew build shadowjar". > > > 3. After build, you can find the plugin in "[project > root]/build/libs" > > > with file name "plugin-UPnP2-1.0-SNAPSHOT-all.jar". > > > > > > Thanks, > > > Xiaoyu > > > _______________________________________________ > > > Devl mailing list > > > [email protected] > > > https://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl > > _______________________________________________ > > Devl mailing list > > [email protected] > > https://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl > _______________________________________________ > Devl mailing list > [email protected] > https://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl > _______________________________________________ Devl mailing list [email protected] https://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
