Posted March 21, 201411 yr Greetings, I downloaded and installed the latest 1.7.2 source and when I tried to setup logging like the old tutorials examples Eclipse indicated that there was problems with the following statements. public static Logger logger; logger = Logger.getLogger(MODID); logger.setParent(FMLLog.getLogger()); When I investigated the FML source I discovered that FMLLog no longer imports import java.util.logging.Level; import java.util.logging.Logger; but instead uses import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Logger; If i import log4j I get an error with "logger = Logger.getLogger(MODID);" if I import the old java.util.logging i get errors with "logger.setParent(FMLLog.getLogger());" So how do I properly use Logging with 1.7.2 mods? Thanks in advanced GuardStar GuardStar
March 21, 201411 yr I use my common proxy class. import cpw.mods.fml.common.FMLLog; import org.apache.logging.log4j.Logger; private static final Logger logger = FMLLog.getLogger(); . . . public void print(String s) { logger.info(s); }
March 22, 201411 yr I'm using this, which seems to work: public static org.apache.logging.log4j.Logger logger; @EventHandler public void preInit(FMLPreInitializationEvent event){ logger = event.getModLog(); logger.info("Something"); }
March 22, 201411 yr I use this, private static final Logger logger = LogManager.getFormatterLogger(MODID); -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
March 23, 201411 yr I use the following to register a new Logger public static final Logger LOGGER = LogManager.getLogger("LoggerName");
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.