Bedrock_Miner Posted December 29, 2014 Posted December 29, 2014 Heyho guys! Just a small question, how do I enable the logs of the DEBUG or even TRACE level inside of eclipse? Quote http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
Draco18s Posted December 29, 2014 Posted December 29, 2014 Window -> Show View -> Console Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Bedrock_Miner Posted December 29, 2014 Author Posted December 29, 2014 I know how to display the output of the program! I want to know how I can make Forge show the logs that are made using FMLLog.log(Level.DEBUG, format, data); and so on... Quote http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
Draco18s Posted December 29, 2014 Posted December 29, 2014 http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Bedrock_Miner Posted December 29, 2014 Author Posted December 29, 2014 I looked over this, added -debug to the VM Arguments and got the same result as always. But I want to see the debug logs as they are listed in fml-client-latest.log. Why did they add the "Levels" of logging if you cannot make them appear in the console? Quote http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
Draco18s Posted December 29, 2014 Posted December 29, 2014 eclipse.log.level ? Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Bedrock_Miner Posted December 29, 2014 Author Posted December 29, 2014 Well, great.. Another thing which sounds so easy and I just don't understand it. How/Where do I use this eclipse.log.level? (Please explain idiot-safe) Quote http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
Draco18s Posted December 29, 2014 Posted December 29, 2014 Quote The Eclipse runtime options Version 3.6 - Last revised August 5, 2009 The Eclipse platform is highly configurable. Configuration input takes the form of command line arguments and System property settings. In many cases the command line arguments are simply short cuts for setting the related System properties. In fact, there are many more System property settings than command line arguments. It's a program option flag you can set when launching Eclipse (either via command line or via a shortcut). Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Bedrock_Miner Posted December 29, 2014 Author Posted December 29, 2014 OK, thank you!! But now I set the level to ALL and still get no DEBUG or TRACE logs... Quote http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
Draco18s Posted December 29, 2014 Posted December 29, 2014 I haven't used it TBH. I just googled around. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Bedrock_Miner Posted December 29, 2014 Author Posted December 29, 2014 Yeah, I did a lot of googling before as well, but I couldn't find anything useful... Quote http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
pickaxe_engineer Posted December 29, 2014 Posted December 29, 2014 Hello Do you use this logger: event.getModLog(); //event is preInit event Because for this one, the javadoc sais: Quote Get a logger instance configured to write to the FML Log as a parent, identified by modid. Handy for mod logging! Configurations can be applied through the config/logging.properties file, specifying logging levels for your ModID. Use this! The point that I dont get, is which config folder do I have to use? The one that is child of eclipse/ ? Then again, log4j 2 tells us to use either a JSON, XML or YAML file - why forge wants us to use a properties file? Sincerely -pick Quote Since English is not my mother tongue, my sentences may are confusing. I'm coding java for a long time now - just MC and forge stop me sometimes.
Bedrock_Miner Posted January 2, 2015 Author Posted January 2, 2015 Tried this but didn't work. Why?! ((Logger)LogManager.getLogger(Minersbasic.MODID)).setLevel(Level.ALL); ((Logger)LogManager.getLogger(Minersbasic.MODID)).info("test"); //Only this was logged ((Logger)LogManager.getLogger(Minersbasic.MODID)).debug("test"); ((Logger)LogManager.getLogger(Minersbasic.MODID)).trace("test"); Logger is org.apache.logging.log4j.core.Logger. Quote http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
Bedrock_Miner Posted January 2, 2015 Author Posted January 2, 2015 OK, little bit of research showed the following: The LoggerConfig of the FML Logger is set to Level.INFO in the file log4j2.xml: <Root level="all"> <AppenderRef ref="FmlSysOut" level="INFO" /> <AppenderRef ref="ServerGuiConsole" level="INFO" /> <AppenderRef ref="FmlFile"/> </Root> I need to get this LoggerConfig object, then I can change the level. Problem: The object is wrapped in another object of the class PrivateConfig which is defined as a protected class inside Logger. Can I get the Object via reflection somehow? Quote http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
LordDrikon Posted October 8, 2015 Posted October 8, 2015 Did you ever find out how to turn on debug messages to the gui? I understand sending debug and trace messages to the gui is not a good idea. However during development of a private mod I don't mind seeing my mod's debug and trace messages in the gui. I have tried a log4j2.xml with select <Logger> named and leveled settings, one file in each part of the entire class path, to no avail. Meaning I clearly missed something. I used several loggers: org.apache.logging.log4j.Logger and FMLog() I get log messages, just not with TRACE or DEBUG levels.I presume that those logger levels don't have appenders to the console. I have failed to get it to work with trace and debug. I've tried .fine() and .finer() as well. I've seen many working examples of FMLLog.info() or FMLLog.warn() or FMLLog.log() or using non-fml loggers, just not for debug and trace. I understand debug and trace go to the log files. I saw somewhere that a core forge developer wanted mod developers to setup our own mod logging. I just seems that the rootlogger is preconfigured in a way that add perhaps some confusion, at least for me. Quote
jabelar Posted October 9, 2015 Posted October 9, 2015 While I haven't tried it myself (I plan to though because this has bugged me for a long time), a friend said you can get around the hard-coded limitation as follows: You have to edit the forge-jar for that. What you do is open the jar that gradle downloaded and automatically includes in the buildpath for you. It is at C:/Users/<user>/.gradle/caches/minecraft/net/minecraftforge/forge/1.8-11.14.3.1450/snapshot/<YYYYMMDD>/forgeSrc-<version>.jar. There should be a file named log4j2.xml in there, extract it and edit the line where it says <AppenderRef ref="FmlSysOut" level="INFO" /> to <AppenderRef ref="FmlSysOut" level="DEBUG" /> Save and override the file in the jar. You should now see debug output on your console. The only thing is you have to remember to repeat this every time the workspace is refreshed. Which is every time the version is changed and you used setupDecompWorkspace. Try it out and let me know if it works. I don't have time at the moment. Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
Bedrock_Miner Posted October 9, 2015 Author Posted October 9, 2015 Basically this must work because its the normal way you change logging behaviour with log4j. Butdoes anyone know where this file is actually loaded and in which variables the content is stored? I was looking for a possibility to enable this from code via reflection. Quote http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
cryxli Posted October 14, 2015 Posted October 14, 2015 I may have found a way to "enable" logging the way we are used to. Please, verify my train of thoughts: [*]Fact: I'm using eclipse. [*]Fact: Forge uses log4j2 [*]Fact: log4j2 is configured using properties/XML files. If missing log4j(2) will log an error right at the beginning. No error observed, log4j must be configured somewhere. [*]Fact: The lib forgeSrc-<version>.jar contains a log4j2.xml [*]Action: Copy this file to the root directory of the project. Question: Which directory is the root? [*]Observation: When starting the client using the eclipse launcher, a directory structure just like the one known from a normal forge installation is created within the "eclipse" dir. [*]Action: Putting log4j2.xml into eclipse dir. [*]Action: Verify which logger my mod gets in the pre-init phase. FMLPreInitializationEvent event; event.getModLog().getName() Is seems to be one named like my MOD-ID. [*]Action: Adding a logger for my mod to my log4j2.xml <Loggers> [...] <Logger level="debug" name="myModId"> <AppenderRef ref="FmlSysOut" /> </Logger> </Loggers> (Not yet investigated what the 5 defined appenders do.) [*]Action: Start client. Observation: I'm still logging INFO. [*]Action: Force log4j2 to load my file by adding a VM argument to the launcher config next to the memory size: -Xincgc -Xmx1024M -Xms1024M -Dlog4j.configurationFile=log4j2.xml [*]Action: Start client. Observation: I'm logging DEBUG. My idea is to have the dev env configured to log the way I want and not having to change my code or alter libs. Therefore, tweaking the launcher config and copying the logging config is acceptable, I think. Quote
jabelar Posted October 14, 2015 Posted October 14, 2015 Yeah, that is the way I thought I tried a few times. Basically supercede the xml with my own. However I never quite got it to work. Although I'm pretty sure I tried each of the things you mention, I may have missed putting them together in combination correctly. I'll try it out. Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
Recommended Posts
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.