Posted November 22, 2015 (edited) The topic came up a few times the last days. So far there's not much debug output from the server or the client especially when running the exes. On Windows the windows with debug output will close right away and the client won't even print this messages to a console when started from one. So here are a few ways to get (some) debug output from client and server. Since both client and server are using Java the standard Java logging methods can be used to create log files. It requires a configuration file "logging.properties" and a way to tell Java to read the configuration Server: Save this to logging.properties: handlers=java.util.logging.FileHandler,java.util.logging.ConsoleHandler .level=INFO java.util.logging.FileHandler.pattern = server.log java.util.logging.FileHandler.count = 1 java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter # Limit the message that are printed on the console to INFO and above. java.util.logging.ConsoleHandler.level = INFO java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter java.util.logging.SimpleFormatter.format=[%1$tr] %4$s %3$s: %5$s%6$s%n modlauncher.bat and modlauncher.sh will add the needed parameters to the startup process to log to the console and to server.log. When the server is started through the exe (or the Linux equivalent) a few changes are required in LaunchConfig.ini JvmParam1=-Djava.util.logging.config.file=logging.properties The number must be adjusted to match the other JvmParam values. It must be incremented by 1 for every parameter present Client: The client is pretty similar. Due to the missing console window no console output is needed handlers=java.util.logging.FileHandler .level=INFO java.util.logging.FileHandler.pattern = client.log java.util.logging.FileHandler.count = 1 java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter java.util.logging.SimpleFormatter.format=[%1$tr] %4$s %3$s: %5$s%6$s%n Since there is no other way but to start through the launcher the logging property must be set in LaunchConfig.ini JvmParam1=-Djava.util.logging.config.file=logging.properties The number must be adjusted to match the other JvmParam values. It must be incremented by 1 for every parameter present Additional log output can be generated by adding this to LaunchConfig.ini too [Debug] DebugMode=1 The messages will end up in a console window but not in the log file Edited January 22, 2016 by ago adjusted logging.properties to include exception stack traces 1 Share this post Link to post Share on other sites
Posted November 25, 2015 Total non-programmer here with a few questions.. Running on a win 8.1 PC 1) How do I make my server log EVERYTHING to a .txt file?(or multiple files - Startup.txt, Errors.txt, Playername.txt, GMName.txt etc etc) if it happens on my server, I want to be able to go back and find it in the logs... Not just startup/debug info, but EVERYTHING! 2) What are all the available xxx.level options? ( ie: java.util.logging.ConsoleHandler.level = INFO ) 3) Can the different levels be directed to different .txt files? ( INFO_Debug.txt, Other_Level_Debug.txt etc) as well as to a generic startup_log.txt? 4) Not exactly 100% related, but does anyone know a way I can force the console window to remain open on a crash so I can see what it says? Thanks Share this post Link to post Share on other sites
Posted November 26, 2015 (edited) 14 hours ago, Vanyel said: Total non-programmer here with a few questions.. Running on a win 8.1 PC 1) How do I make my server log EVERYTHING to a .txt file?(or multiple files - Startup.txt, Errors.txt, Playername.txt, GMName.txt etc etc) if it happens on my server, I want to be able to go back and find it in the logs... Not just startup/debug info, but EVERYTHING! 2) What are all the available xxx.level options? ( ie: java.util.logging.ConsoleHandler.level = INFO ) 3) Can the different levels be directed to different .txt files? ( INFO_Debug.txt, Other_Level_Debug.txt etc) as well as to a generic startup_log.txt? 4) Not exactly 100% related, but does anyone know a way I can force the console window to remain open on a crash so I can see what it says? Thanks 2) Lets start with the levels. There is SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST. 1) To get all log messages you'd set .LEVEL=FINEST although that's probably way too much output You can set options for a specific logging branch eg. com.wurmonline.server.LEVEL=FINER will print pretty detailed logs from the server but not from othe code like the mods. When you set a level on a a handler like the ConsoleHandler you can restrict how detailed the output into the handler is 3) A level usually includes all higher levels. So outputting WARNING to a file will also have SEVERE in that file. So only outputting FINEST but not FINER into a file will probably not work unless a custom handler is written. 4) when you run modlauncher.bat from a console window you will have the errors around. I don't know of any other way to keep the window open. The logging is described in great detail at http://tutorials.jenkov.com/java-logging/index.html Edited November 26, 2015 by ago 1 Share this post Link to post Share on other sites
Posted January 2, 2023 hi....pls help Does anyone know how to edit the logging.properties to show the date? original: java.util.logging.SimpleFormatter.format=[%1$tr] %4$s %3$s: %5$s%6$s%n do this: [04:34:26 ODP.] INFO com.wurmonline.server.Server: current mem in use: 2090M free mem: 1109M Max mem: 2090M i want this format: [01.02.2023 04:34:26 ODP.] INFO com.wurmonline.server.Server: current mem in use: 2090M free mem: 1109M Max mem: 2090M thank you in advance Share this post Link to post Share on other sites
Posted January 3, 2023 21 hours ago, byxoft said: hi....pls help Does anyone know how to edit the logging.properties to show the date? original: java.util.logging.SimpleFormatter.format=[%1$tr] %4$s %3$s: %5$s%6$s%n do this: [04:34:26 ODP.] INFO com.wurmonline.server.Server: current mem in use: 2090M free mem: 1109M Max mem: 2090M i want this format: [01.02.2023 04:34:26 ODP.] INFO com.wurmonline.server.Server: current mem in use: 2090M free mem: 1109M Max mem: 2090M thank you in advance I have already been advised = [%1$tF %1$tr] %4$s %3$s: %5$s%6$s%n thx Tyoda 1 Share this post Link to post Share on other sites