View Full Version : [Solved] accessing getApi().getLogger from classes not extending anything
07-18-2011, 05:39 PM
Is there a way to access the logger from a class not extending baseplugin or any of the managed API's?
07-18-2011, 05:52 PM
The simplest way is to have the plugin pass a Logger variable (getApi().getLogger()) or an ElectroServerApi variable (getApi()).
The usual practice is to use
private static final Logger logger = LoggerFactory.getLogger(NAME_OF_JAVA_CLASS_HERE.cl ass);
If you use the second, you will need to modify server/config/log4j.properties to set the logging level. See Logging (http://www.electrotank.com/docs/es5/manual/logging.htm).
07-18-2011, 05:54 PM
Ahh. I had the second method implemented but it was not showing anything, so was wondering what I missed. Looks like it was the log4j.properties :) Thanks!
07-18-2011, 05:56 PM
If you have questions about how to configure log4j.properties, you know where to find me. ;)
07-18-2011, 06:01 PM
yeah it was easy to figure out, I got it working, thanks very much!
Powered by vBulletin® Version 4.1.6 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.