Jump to content

How to enable "debug" logging in eclipse?


Bedrock_Miner

Recommended Posts

Window -> Show View -> Console

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

eclipse.log.level ?

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.

Link to comment
Share on other sites

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).

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.

Link to comment
Share on other sites

I haven't used it TBH.  I just googled around.

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.

Link to comment
Share on other sites

Hello

 

Do you use this logger:

event.getModLog(); //event is preInit event

 

Because for this one, the javadoc sais:

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

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

  • 9 months later...

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.

 

Link to comment
Share on other sites

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.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • when i join it looks normal until i look a mob or i have some thing in my hand and my screen starts turning different colors when i look around. i can see my inventory and the menu but not mobs or blocks in my hand I've tried to turn off the anti virus  uninstall and reinstalling the best driver  going back from version 20 to 8 and putting a ton of ram into minecraft. if i could get any help. thank you
    • Hi fellow minecrafter,   We've got exciting news from the Pacific Laboratory for Artificial Intelligence (PLAI) at UBC! We're merging the worlds of Minecraft and AI research, and you're invited to join through our platform, plaicraft.ai, to aid our data collection process. It's not just playing games; it's contributing to cutting-edge AI research.   BetterStructures and more!!: We want to make the server as fun as possible for everyone so we recently added a bunch of structural plugins that adds over a hundred of new structures and sites for you to explore and challenge. We are also working on PVP, bedwars and skyblock content, which will make the server even more fun!   Here’s how you can get involved! -Register on plaicraft.ai with your email(you can fake one, as long as you can receive email from it it's fine). -Complete a consent form. -Play Minecraft and contribute to science! (all you need is a Chrome browser and a steady internet, you'll be playing on VM)   Why You Should Participate? -Support AI Research: Your gameplay directly contributes to important AI advancements.  -Free Minecraft Access: Enjoy the game without any cost. -We have shaders and a bunch of cool mods loaded on our instances  -Great Community: Our server currently has a fantastic community, with many awesome players you can meet.   Elephant in the room: Now I want to address some obvious concerns, I sure did a good job making us sound like a scam by the above content. I know that the "free Minecraft" thing has always been taboo in the Minecraft community. So how can I prove to you that this is not a scam? - The easiest way and most official way is that we are approved by the University of British Columbia ethics board, our BREB number is H23-02389. You can verify this case number yourself. - The harder way is that I'll explain the technical details of this project and why we choose to provide free Minecraft. So the goal of this project is very similar to the paper MineDojo or MineRL, we want to collect a multi-modal dataset that consists of video, audio, keyboard and mouse movement. Minecraft has been a very important simulation environment for the ML community and there are tons of papers related to it. Now we obviously don't have enough money like those big tech companies who can just pay people to play, so we have to turn to the Minecraft community. To record all the data mentioned, there needs to be a lot of setup and coding, and it's definitely impossible for us to ask people to run these recording programs on their personal computers. So we carefully configured the AWS EC2 instance to run Minecraft alongside the programs. And that's where and why we also provide you with free Minecraft licenses, of course, we are not giving the account to you, just allowing you to be able to play Minecraft on these instances. You might ask, "Why can't I log in with my account on the instances?", that's because first login with your personal Minecraft account is another privacy risk; second not all our target audiences have an account; and lastly we restricted a lot on what you can do on the instance, basically all you can do is play Minecraft and that's all the data we want, allowing you to log in will make things complicated to control.   For more information on the project and the team, visit Dr. Frank Wood’s website or follow @frankdonaldwood on Twitter. You can also learn more about PLAI lab research on our website (just search ubc plai). Join us in transforming your gaming experience into a meaningful contribution to AI research. Let’s push the boundaries of what gaming can achieve together! Happy plaiing!   Best,  The PLAI Team
    • The mod has improved a lot from yesterday just 1 last issue  Here's the crash report- https://pastebin.com/k2A1BAKn   Please help, Thanks.
    • Take Your Gaming Experience to the Next Level with These Essential Tools   If you're a Minecraft enthusiast, you've likely experienced the need to customize your world and server to make it more exciting and challenging. Fortunately, there's a perfect solution for you: https://menzatyx.xyz, the website that offers a wide selection of free and pre-configured Minecraft plugins. At https://menzatyx.xyz, you'll find a diverse range of plugins that will allow you to take your gaming experience to the next level. From server management tools to mods that add new functionalities, each of these plugins has been carefully selected and configured, so you can enjoy a more personalized and thrilling Minecraft experience. One of the primary benefits of using these pre-configured plugins is the ease of implementation. You no longer have to spend hours configuring and adjusting each individual plugin. Simply download the package that best suits your needs, and you're good to go! You'll be able to enjoy all the features and improvements without investing too much time and effort. From plugins that enhance the security of your server to mods that add new game modes, the variety offered by https://menzatyx.xyz is impressive. Moreover, as these are free plugins, you can access these tools without spending a single penny. It's the perfect opportunity to take your Minecraft experience to the next level without affecting your wallet! Whether you're a casual player or an experienced server administrator, at https://menzatyx.xyz you'll find the Minecraft plugins you need to personalize and enhance your game. Visit the website now and discover how you can transform your Minecraft world into something unique and thrilling!
    • Meaning I need to restart the server and redownload cobblemon?
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.