diff --git a/Mage.Client/config/dev_readme.txt b/Mage.Client/config/dev_readme.txt new file mode 100644 index 0000000000..7c4aaa8a54 --- /dev/null +++ b/Mage.Client/config/dev_readme.txt @@ -0,0 +1,3 @@ +Xmage load default logs settings from resources. + +If you want to run app with different log configs then copy files from release/config folder and add it to command line. \ No newline at end of file diff --git a/Mage.Client/config/log4j.properties b/Mage.Client/config/log4j.properties deleted file mode 100644 index aab212f321..0000000000 --- a/Mage.Client/config/log4j.properties +++ /dev/null @@ -1,14 +0,0 @@ -#default levels -log4j.rootLogger=info, console, logfile - -#console log -log4j.appender.console=org.apache.log4j.ConsoleAppender -log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n -log4j.appender.console.Threshold=info - -#file log -log4j.appender.logfile=org.apache.log4j.FileAppender -log4j.appender.logfile.File=mageserver.log -log4j.appender.logfile.layout=org.apache.log4j.PatternLayout -log4j.appender.logfile.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n \ No newline at end of file diff --git a/Mage.Client/config/security.policy b/Mage.Client/config/security.policy deleted file mode 100644 index dda47ba918..0000000000 --- a/Mage.Client/config/security.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant { - permission java.security.AllPermission; -}; \ No newline at end of file diff --git a/Mage.Client/release/config/log4j.properties b/Mage.Client/release/config/log4j.properties index aab212f321..ca9449888f 100644 --- a/Mage.Client/release/config/log4j.properties +++ b/Mage.Client/release/config/log4j.properties @@ -1,14 +1,36 @@ -#default levels +#SAMPLE CLIENT CONFIG (you must enable it by command line) + +#default log level and active appenders (dest for logs) log4j.rootLogger=info, console, logfile +#custom log level for java classes +#log4j.logger.com.j256.ormlite=warn +#log4j.logger.mage.player.ai=warn + #console log log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n log4j.appender.console.Threshold=info -#file log +#file log - without rolling log4j.appender.logfile=org.apache.log4j.FileAppender -log4j.appender.logfile.File=mageserver.log log4j.appender.logfile.layout=org.apache.log4j.PatternLayout -log4j.appender.logfile.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n \ No newline at end of file +log4j.appender.logfile.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n +log4j.appender.logfile.File=mageclient.log + +#file log - rolling by index +log4j.appender.logfileByIndex=org.apache.log4j.RollingFileAppender +log4j.appender.logfileByIndex.layout=org.apache.log4j.PatternLayout +log4j.appender.logfileByIndex.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n +log4j.appender.logfileByIndex.File=mageclient.log +log4j.appender.logfileByIndex.MaxFileSize=10MB +log4j.appender.logfileByIndex.MaxBackupIndex=5 +log4j.appender.logfileByIndex.append=true + +#file log - rolling by dayly +log4j.appender.logfileByDayly=org.apache.log4j.DailyRollingFileAppender +log4j.appender.logfileByDayly.layout=org.apache.log4j.PatternLayout +log4j.appender.logfileByDayly.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n +log4j.appender.logfileByDayly.File=mageclient.log +log4j.appender.logfileByDayly.DatePattern='.'yyyy-MM-dd \ No newline at end of file diff --git a/Mage.Client/release/config/readme.txt b/Mage.Client/release/config/readme.txt new file mode 100644 index 0000000000..caa72a071d --- /dev/null +++ b/Mage.Client/release/config/readme.txt @@ -0,0 +1,3 @@ +It's a sample config files. If you want to use it then run app with that extra commands (add it in launcher settings or in run script): +-Dlog4j.configuration=file:./config/log4j.properties +-Djava.security.policy=./config/security.policy \ No newline at end of file diff --git a/Mage.Client/src/main/java/mage/client/dialog/MageDialog.java b/Mage.Client/src/main/java/mage/client/dialog/MageDialog.java index 5abf39fff2..8164200971 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/MageDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/MageDialog.java @@ -11,7 +11,6 @@ import java.awt.event.InvocationEvent; import java.awt.event.MouseEvent; import java.beans.PropertyVetoException; import java.lang.reflect.InvocationTargetException; -import java.util.logging.Level; /** * @author BetaSteward_at_googlemail.com, JayDi85 @@ -215,7 +214,7 @@ public class MageDialog extends javax.swing.JInternalFrame { try { this.setClosed(true); } catch (PropertyVetoException ex) { - java.util.logging.Logger.getLogger(MageDialog.class.getName()).log(Level.SEVERE, "setClosed(false) failed", ex); + LOGGER.error("setClosed(false) failed", ex); } MageFrame.getDesktop().remove(this); } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GrabbagImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GrabbagImageSource.java index 0bc422ef18..4ae31f782a 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GrabbagImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GrabbagImageSource.java @@ -7,7 +7,6 @@ import org.mage.plugins.card.images.CardDownloadData; import java.io.IOException; import java.util.*; import java.util.concurrent.TimeUnit; -import java.util.logging.Level; /** * @author spjspj @@ -15,7 +14,7 @@ import java.util.logging.Level; public enum GrabbagImageSource implements CardImageSource { instance; - private static final Logger logger = Logger.getLogger(GrabbagImageSource.class); + private static final Logger LOGGER = Logger.getLogger(GrabbagImageSource.class); private static final Set supportedSets = new LinkedHashSet() { { @@ -454,7 +453,7 @@ public enum GrabbagImageSource implements CardImageSource { try { return generateCardUrl(card); } catch (Exception ex) { - java.util.logging.Logger.getLogger(GrabbagImageSource.class.getName()).log(Level.SEVERE, null, ex); + LOGGER.error(ex.getMessage(), ex); } return null; } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java index ad8f654f47..c4414dcd1b 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java @@ -15,7 +15,6 @@ import java.net.Proxy; import java.net.URL; import java.net.URLConnection; import java.util.*; -import java.util.logging.Level; /** * @author Quercitron @@ -23,7 +22,7 @@ import java.util.logging.Level; public enum TokensMtgImageSource implements CardImageSource { instance; - private static final Logger logger = Logger.getLogger(TokensMtgImageSource.class); + private static final Logger LOGGER = Logger.getLogger(TokensMtgImageSource.class); // [[EXP/Name, TokenData> private HashMap> tokensData; @@ -99,14 +98,14 @@ public enum TokensMtgImageSource implements CardImageSource { // We don't know these numbers, but we can take them from a file // with tokens information that can be downloaded from the site. if (tokensData.isEmpty()) { - logger.info("Source " + getSourceName() + " provides no token data."); + LOGGER.info("Source " + getSourceName() + " provides no token data."); return null; } String key = set + "/" + name; List list = tokensData.get(key); if (list == null) { - logger.warn("Could not find data for token " + name + ", set " + set + "."); + LOGGER.warn("Could not find data for token " + name + ", set " + set + "."); return null; } @@ -115,7 +114,7 @@ public enum TokensMtgImageSource implements CardImageSource { tokenData = list.get(0); } else { if (type > list.size()) { - logger.warn("Not enough images variants for token with type number " + type + ", name " + name + ", set " + set + '.'); + LOGGER.warn("Not enough images variants for token with type number " + type + ", name " + name + ", set " + set + '.'); return null; } tokenData = list.get(card.getType() - 1); @@ -137,7 +136,7 @@ public enum TokensMtgImageSource implements CardImageSource { try { getTokensData(); } catch (IOException ex) { - logger.error(getSourceName() + ": Loading available data failed. " + ex.getMessage()); + LOGGER.error(getSourceName() + ": Loading available data failed. " + ex.getMessage()); } return tokensData.size(); } @@ -172,7 +171,7 @@ public enum TokensMtgImageSource implements CardImageSource { try { getTokensData(); } catch (IOException ex) { - java.util.logging.Logger.getLogger(TokensMtgImageSource.class.getName()).log(Level.SEVERE, null, ex); + LOGGER.error(ex.getMessage(), ex); } String key = setCode + "/" + searchName; return (tokensData.containsKey(key)); @@ -199,12 +198,12 @@ public enum TokensMtgImageSource implements CardImageSource { list = new ArrayList<>(); tokensData.put(key, list); supportedSets.add(tokenData.getExpansionSetCode()); - logger.debug("Added key: " + key); + LOGGER.debug("Added key: " + key); } list.add(tokenData); } } catch (Exception exception) { - logger.warn("Failed to get tokens description from resource file tokens-mtg-onl-list.csv", exception); + LOGGER.warn("Failed to get tokens description from resource file tokens-mtg-onl-list.csv", exception); } String urlString = "http://tokens.mtg.onl/data/SetsWithTokens.csv"; @@ -240,7 +239,7 @@ public enum TokensMtgImageSource implements CardImageSource { DownloadPicturesService.getInstance().updateMessage(""); DownloadPicturesService.getInstance().showDownloadControls(true); } catch (Exception ex) { - logger.warn("Failed to get tokens description from tokens.mtg.onl", ex); + LOGGER.warn("Failed to get tokens description from tokens.mtg.onl", ex); DownloadPicturesService.getInstance().updateMessage(ex.getMessage()); } } diff --git a/Mage.Client/src/main/resources/log4j.properties b/Mage.Client/src/main/resources/log4j.properties index 3ab8d112d7..336d88d9b9 100644 --- a/Mage.Client/src/main/resources/log4j.properties +++ b/Mage.Client/src/main/resources/log4j.properties @@ -1,26 +1,36 @@ -#This configuration file is used for the client started from the IDE -#default levels -log4j.rootLogger=info, console, logfile -# Suppress SQL info messages -log4j.logger.com.j256.ormlite=warn +#default settings (uses for CLIENT run) + +#default log level and active appenders (dest for logs) +log4j.rootLogger=info, console, logfile + +#custom log level for java classes +#log4j.logger.com.j256.ormlite=warn +#log4j.logger.mage.player.ai=warn -#log4j.logger.org.jboss.remoting=debug -#log4j.logger.org.jboss.logging=debug -#log4j.logger.mage.player.ai.ComputerPlayer6=debug -#log4j.logger.mage.client.remote.CallbackClientImpl=debug -#log4j.logger.mage.client.remote.CallbackClientImpl=debug -#log4j.logger.mage.client.game.FeedbackPanel=debug -#log4j.logger.mage.client.game.FeedbackPanel=warn -#log4j.logger.mage.client.util.audio=debug - #console log log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n log4j.appender.console.Threshold=info -#file log +#file log - without rolling log4j.appender.logfile=org.apache.log4j.FileAppender -log4j.appender.logfile.File=mageclient.log log4j.appender.logfile.layout=org.apache.log4j.PatternLayout -log4j.appender.logfile.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n \ No newline at end of file +log4j.appender.logfile.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n +log4j.appender.logfile.File=mageclient.log + +#file log - rolling by index +log4j.appender.logfileByIndex=org.apache.log4j.RollingFileAppender +log4j.appender.logfileByIndex.layout=org.apache.log4j.PatternLayout +log4j.appender.logfileByIndex.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n +log4j.appender.logfileByIndex.File=mageclient.log +log4j.appender.logfileByIndex.MaxFileSize=10MB +log4j.appender.logfileByIndex.MaxBackupIndex=5 +log4j.appender.logfileByIndex.append=true + +#file log - rolling by dayly +log4j.appender.logfileByDayly=org.apache.log4j.DailyRollingFileAppender +log4j.appender.logfileByDayly.layout=org.apache.log4j.PatternLayout +log4j.appender.logfileByDayly.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n +log4j.appender.logfileByDayly.File=mageclient.log +log4j.appender.logfileByDayly.DatePattern='.'yyyy-MM-dd \ No newline at end of file diff --git a/Mage.Common/config/log4j.properties b/Mage.Common/config/log4j.properties deleted file mode 100644 index c1cd7b3d3b..0000000000 --- a/Mage.Common/config/log4j.properties +++ /dev/null @@ -1,8 +0,0 @@ -#default levels -log4j.rootLogger=debug, console - -#console log -log4j.appender.console=org.apache.log4j.ConsoleAppender -log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern=%-5p [%d{yyyy-MM-dd HH:mm [ss:SSS]}] %C{1}[%t]: %m%n -log4j.appender.console.Threshold=debug diff --git a/Mage.Server.Console/src/main/resources/log4j.properties b/Mage.Server.Console/src/main/resources/log4j.properties index f07183abe9..b1efafab4a 100644 --- a/Mage.Server.Console/src/main/resources/log4j.properties +++ b/Mage.Server.Console/src/main/resources/log4j.properties @@ -1,14 +1,20 @@ -#default levels +#default settings (uses for ADMIN run) + +#default log level and active appenders (dest for logs) log4j.rootLogger=info, console, logfile +#custom log level for java classes +#log4j.logger.com.j256.ormlite=warn +#log4j.logger.mage.player.ai=warn + #console log log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M%n -log4j.appender.console.Threshold=DEBUG +log4j.appender.console.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n +log4j.appender.console.Threshold=debug -#file log +#file log - without rolling log4j.appender.logfile=org.apache.log4j.FileAppender -log4j.appender.logfile.File=mageadmin.log log4j.appender.logfile.layout=org.apache.log4j.PatternLayout -log4j.appender.logfile.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M%n \ No newline at end of file +log4j.appender.logfile.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n +log4j.appender.logfile.File=mageadmin.log \ No newline at end of file diff --git a/Mage.Server/config/dev_readme.txt b/Mage.Server/config/dev_readme.txt new file mode 100644 index 0000000000..7c4aaa8a54 --- /dev/null +++ b/Mage.Server/config/dev_readme.txt @@ -0,0 +1,3 @@ +Xmage load default logs settings from resources. + +If you want to run app with different log configs then copy files from release/config folder and add it to command line. \ No newline at end of file diff --git a/Mage.Server/config/log4j.properties b/Mage.Server/config/log4j.properties deleted file mode 100644 index 326e823dcd..0000000000 --- a/Mage.Server/config/log4j.properties +++ /dev/null @@ -1,45 +0,0 @@ -#default levels -#log4j.rootLogger=info, console, logfile -log4j.rootLogger=info, RollingAppender -log4j.logger.com.j256.ormlite=warn -log4j.logger.mage.game=debug -log4j.logger.mage.game.GameImpl=debug -#log4j.logger.mage.players.PlayerImpl=debug -log4j.logger.mage.server=debug -#log4j.logger.mage.server.UserManager=debug -log4j.logger.mage.server.User=trace -#log4j.logger.mage.server.ChatSession=debug -#log4j.logger.mage.server.ChatManager=debug -#log4j.logger.mage.server.TableController=debug -#log4j.logger.mage.server.TableManager=debug -#log4j.logger.mage.server.tournament.TournamentManager=debug -#log4j.logger.mage.server.game.GameSession=debug -log4j.logger.mage.abilities.AbilityImpl=debug -log4j.logger.mage.cards.decks=debug -log4j.logger.mage.abilities.effects.common.continious.CommanderManaReplacementEffect=debug - -#console log -#log4j.appender.console=org.apache.log4j.ConsoleAppender -#log4j.appender.console.layout=org.apache.log4j.PatternLayout -#log4j.appender.console.layout.ConversionPattern=%-5p [%d{yyyy-MM-dd HH:mm [ss:SSS]}] %C{1}[%t]: %m% -#log4j.appender.console.Threshold=info - -#file log -#log4j.appender.logfile=org.apache.log4j.FileAppender -#log4j.appender.logfile.File=mageserver.log -#log4j.appender.logfile.layout=org.apache.log4j.PatternLayout -#log4j.appender.logfile.layout.ConversionPattern=%-5p [%d{yyyy-MM-dd HH:mm [ss:SSS]}] %C{1}[%t]: %m%n - -log4j.appender.RollingAppender=org.apache.log4j.DailyRollingFileAppender -log4j.appender.RollingAppender.File=mageserver.log -log4j.appender.RollingAppender.DatePattern='.'yyyy-MM-dd -log4j.appender.RollingAppender.layout=org.apache.log4j.PatternLayout -log4j.appender.RollingAppender.layout.ConversionPattern=[%p] %d %c %M - %m%n -log4j.appender.RollingAppender.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M%n -#diagnostic log for game core classes -#log4j.category.mage.server.game = INFO, diagfile -#log4j.additivity.mage.server.game = false -#log4j.appender.diagfile=org.apache.log4j.FileAppender -#log4j.appender.diagfile.File=magediag.log -#log4j.appender.diagfile.layout=org.apache.log4j.PatternLayout -#log4j.appender.diagfile.layout.ConversionPattern=%-5p [%d{yyyy-MM-dd HH:mm [ss:SSS]}] %C{1}[%t]: %m%n \ No newline at end of file diff --git a/Mage.Server/config/logging.properties b/Mage.Server/config/logging.properties deleted file mode 100644 index 7d350d8575..0000000000 --- a/Mage.Server/config/logging.properties +++ /dev/null @@ -1,5 +0,0 @@ -# Default global logging level. -.level=FINER - -# Set the default logging level for new ConsoleHandler instances -java.util.logging.ConsoleHandler.level = ALL \ No newline at end of file diff --git a/Mage.Server/config/security.policy b/Mage.Server/config/security.policy deleted file mode 100644 index dda47ba918..0000000000 --- a/Mage.Server/config/security.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant { - permission java.security.AllPermission; -}; \ No newline at end of file diff --git a/Mage.Server/release/config/log4j.properties b/Mage.Server/release/config/log4j.properties index f4a0daec5a..5ecfe66d8f 100644 --- a/Mage.Server/release/config/log4j.properties +++ b/Mage.Server/release/config/log4j.properties @@ -1,15 +1,46 @@ -#default levels +#SAMPLE SERVER CONFIG (you must enable it by command line) + +#default log level and active appenders (dest for logs) log4j.rootLogger=info, console, logfile -log4j.logger.com.j256.ormlite=warn -log4j.logger.mage.player.ai=warn + +#custom log level for java classes +#log4j.logger.com.j256.ormlite=warn +#log4j.logger.mage.player.ai=warn + +#custom log file with diag info (only from special classes) +#log4j.category.mage.server.game = INFO, diagfile +#log4j.category.mage.server.tournament = INFO, diagfile +#log4j.additivity.mage.server.game = false +#log4j.additivity.mage.server.tournament = false +#log4j.appender.diagfile=org.apache.log4j.FileAppender +#log4j.appender.diagfile.File=magediag.log +#log4j.appender.diagfile.layout=org.apache.log4j.PatternLayout +#log4j.appender.diagfile.layout.ConversionPattern=%-5p [%d{yyyy-MM-dd HH:mm [ss:SSS]}] %C{1}[%t]: %m%n + #console log log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M%n +log4j.appender.console.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n log4j.appender.console.Threshold=info -#file log +#file log - without rolling log4j.appender.logfile=org.apache.log4j.FileAppender -log4j.appender.logfile.File=mageserver.log log4j.appender.logfile.layout=org.apache.log4j.PatternLayout -log4j.appender.logfile.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M%n \ No newline at end of file +log4j.appender.logfile.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n +log4j.appender.logfile.File=mageserver.log + +#file log - rolling by index +log4j.appender.logfileByIndex=org.apache.log4j.RollingFileAppender +log4j.appender.logfileByIndex.layout=org.apache.log4j.PatternLayout +log4j.appender.logfileByIndex.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n +log4j.appender.logfileByIndex.File=mageserver.log +log4j.appender.logfileByIndex.MaxFileSize=10MB +log4j.appender.logfileByIndex.MaxBackupIndex=5 +log4j.appender.logfileByIndex.append=true + +#file log - rolling by dayly +log4j.appender.logfileByDayly=org.apache.log4j.DailyRollingFileAppender +log4j.appender.logfileByDayly.layout=org.apache.log4j.PatternLayout +log4j.appender.logfileByDayly.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n +log4j.appender.logfileByDayly.File=mageserver.log +log4j.appender.logfileByDayly.DatePattern='.'yyyy-MM-dd \ No newline at end of file diff --git a/Mage.Server/release/config/logging.properties b/Mage.Server/release/config/logging.properties deleted file mode 100644 index fbf7df750d..0000000000 --- a/Mage.Server/release/config/logging.properties +++ /dev/null @@ -1,5 +0,0 @@ -# Default global logging level. -.level=FINE - -# Set the default logging level for new ConsoleHandler instances -java.util.logging.ConsoleHandler.level = ALL \ No newline at end of file diff --git a/Mage.Server/release/config/readme.txt b/Mage.Server/release/config/readme.txt new file mode 100644 index 0000000000..caa72a071d --- /dev/null +++ b/Mage.Server/release/config/readme.txt @@ -0,0 +1,3 @@ +It's a sample config files. If you want to use it then run app with that extra commands (add it in launcher settings or in run script): +-Dlog4j.configuration=file:./config/log4j.properties +-Djava.security.policy=./config/security.policy \ No newline at end of file diff --git a/Mage.Server/release/startServer.bat b/Mage.Server/release/startServer.bat index 8da532969c..36f799936d 100644 --- a/Mage.Server/release/startServer.bat +++ b/Mage.Server/release/startServer.bat @@ -4,5 +4,5 @@ set JAVA_HOME="C:\Program Files\Java\jre7\" set CLASSPATH=%JAVA_HOME%/bin;%CLASSPATH% set PATH=%JAVA_HOME%/bin;%PATH% :NOJAVADIR -java -Xms256m -Xmx512m -XX:MaxPermSize=384m -Djava.security.policy=./config/security.policy -Djava.util.logging.config.file=./config/logging.config -Dlog4j.configuration=file:./config/log4j.properties -jar ./lib/mage-server-${project.version}.jar +java -Xms256m -Xmx512m -XX:MaxPermSize=384m -Djava.security.policy=./config/security.policy -Dlog4j.configuration=file:./config/log4j.properties -jar ./lib/mage-server-${project.version}.jar pause diff --git a/Mage.Server/release/startServer.command b/Mage.Server/release/startServer.command index dca016e9a7..25a2c28773 100644 --- a/Mage.Server/release/startServer.command +++ b/Mage.Server/release/startServer.command @@ -2,4 +2,4 @@ cd "`dirname "$0"`" -java -Xms256M -Xmx512M -XX:MaxPermSize=256m -Djava.security.policy=./config/security.policy -Djava.util.logging.config.file=./config/logging.config -Dlog4j.configuration=file:./config/log4j.properties -jar ./lib/mage-server-${project.version}.jar +java -Xms256M -Xmx512M -XX:MaxPermSize=256m -Djava.security.policy=./config/security.policy -Dlog4j.configuration=file:./config/log4j.properties -jar ./lib/mage-server-${project.version}.jar diff --git a/Mage.Server/release/startServer.sh b/Mage.Server/release/startServer.sh index 3bac9ce1fa..d6aad3b250 100755 --- a/Mage.Server/release/startServer.sh +++ b/Mage.Server/release/startServer.sh @@ -1,3 +1,3 @@ #!/bin/sh -java -Xms256M -Xmx512M -XX:MaxPermSize=256m -Djava.security.policy=./config/security.policy -Djava.util.logging.config.file=./config/logging.config -Dlog4j.configuration=file:./config/log4j.properties -jar ./lib/mage-server-${project.version}.jar +java -Xms256M -Xmx512M -XX:MaxPermSize=256m -Djava.security.policy=./config/security.policy -Dlog4j.configuration=file:./config/log4j.properties -jar ./lib/mage-server-${project.version}.jar diff --git a/Mage.Server/release/startServerWin7.bat b/Mage.Server/release/startServerWin7.bat index 8bf4bfa0a8..e68dccb608 100644 --- a/Mage.Server/release/startServerWin7.bat +++ b/Mage.Server/release/startServerWin7.bat @@ -4,4 +4,4 @@ set JAVA_HOME="C:\Program Files (x86)\Java\jre7\" set CLASSPATH=%JAVA_HOME%/bin;%CLASSPATH% set PATH=%JAVA_HOME%/bin;%PATH% :NOJAVADIR -java -Xms256M -Xmx512M -XX:MaxPermSize=384m -Djava.security.policy=./config/security.policy -Djava.util.logging.config.file=./config/logging.config -Dlog4j.configuration=file:./config/log4j.properties -jar ./lib/mage-server-${project.version}.jar \ No newline at end of file +java -Xms256M -Xmx512M -XX:MaxPermSize=384m -Djava.security.policy=./config/security.policy -Dlog4j.configuration=file:./config/log4j.properties -jar ./lib/mage-server-${project.version}.jar \ No newline at end of file diff --git a/Mage.Server/src/main/resources/log4j.properties b/Mage.Server/src/main/resources/log4j.properties index 268c9a3495..2c75f2ebde 100644 --- a/Mage.Server/src/main/resources/log4j.properties +++ b/Mage.Server/src/main/resources/log4j.properties @@ -1,29 +1,13 @@ -#default levels +#default settings (uses for SERVER run) + +#default log level and active appenders (dest for logs) log4j.rootLogger=info, console, logfile + +#custom log level for java classes log4j.logger.com.j256.ormlite=warn -#log4j.logger.mage.player.ai=TRACE log4j.logger.mage.player.ai=warn -#log4j.logger.mage.player.ai.ComputerPlayer6=debug -#log4j.logger.mage.player.ai.ComputerPlayer7=debug -#log4j.logger.mage.player.ai.GameStateEvaluator2=debug -#log4j.logger.mage.player.human=DEBUG, console, logfile -#log4j.additivity.mage.player.human=false -log4j.logger.mage.server=debug -#console log -log4j.appender.console=org.apache.log4j.ConsoleAppender -log4j.appender.console.layout=org.apache.log4j.PatternLayout -#log4j.appender.console.layout.ConversionPattern=%-5p [%d{yyyy-MM-dd HH:mm [ss:SSS]}] %C{1}[%t]: %m%n -log4j.appender.console.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M%n -log4j.appender.console.Threshold=DEBUG - -#file log -log4j.appender.logfile=org.apache.log4j.FileAppender -log4j.appender.logfile.File=mageserver.log -log4j.appender.logfile.layout=org.apache.log4j.PatternLayout -log4j.appender.logfile.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M%n - -#diagnostic log for game core classes +#custom log file with diag info (only from special classes) log4j.category.mage.server.game = INFO, diagfile log4j.category.mage.server.tournament = INFO, diagfile log4j.additivity.mage.server.game = false @@ -32,3 +16,31 @@ log4j.appender.diagfile=org.apache.log4j.FileAppender log4j.appender.diagfile.File=magediag.log log4j.appender.diagfile.layout=org.apache.log4j.PatternLayout log4j.appender.diagfile.layout.ConversionPattern=%-5p [%d{yyyy-MM-dd HH:mm [ss:SSS]}] %C{1}[%t]: %m%n + +#console log +log4j.appender.console=org.apache.log4j.ConsoleAppender +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n +log4j.appender.console.Threshold=debug + +#file log - without rolling +log4j.appender.logfile=org.apache.log4j.FileAppender +log4j.appender.logfile.layout=org.apache.log4j.PatternLayout +log4j.appender.logfile.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n +log4j.appender.logfile.File=mageserver.log + +#file log - rolling by index +log4j.appender.logfileByIndex=org.apache.log4j.RollingFileAppender +log4j.appender.logfileByIndex.layout=org.apache.log4j.PatternLayout +log4j.appender.logfileByIndex.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n +log4j.appender.logfileByIndex.File=mageserver.log +log4j.appender.logfileByIndex.MaxFileSize=10MB +log4j.appender.logfileByIndex.MaxBackupIndex=5 +log4j.appender.logfileByIndex.append=true + +#file log - rolling by dayly +log4j.appender.logfileByDayly=org.apache.log4j.DailyRollingFileAppender +log4j.appender.logfileByDayly.layout=org.apache.log4j.PatternLayout +log4j.appender.logfileByDayly.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n +log4j.appender.logfileByDayly.File=mageserver.log +log4j.appender.logfileByDayly.DatePattern='.'yyyy-MM-dd \ No newline at end of file diff --git a/Mage.Tests/config/logging.properties b/Mage.Tests/config/logging.properties deleted file mode 100644 index 5774904804..0000000000 --- a/Mage.Tests/config/logging.properties +++ /dev/null @@ -1,5 +0,0 @@ -# Default global logging level. -.level=ALL - -# Set the default logging level for new ConsoleHandler instances -java.util.logging.ConsoleHandler.level = ALL \ No newline at end of file diff --git a/Mage.Tests/src/frozen/org/mage/test/clientside/base/MageBase.java b/Mage.Tests/src/frozen/org/mage/test/clientside/base/MageBase.java index 057c83b1f3..fd148123c0 100644 --- a/Mage.Tests/src/frozen/org/mage/test/clientside/base/MageBase.java +++ b/Mage.Tests/src/frozen/org/mage/test/clientside/base/MageBase.java @@ -19,8 +19,6 @@ import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import java.util.Date; import java.util.UUID; -import java.util.logging.Level; -import java.util.logging.Logger; /** * Base for starting Mage server. Controls interactions between MageAPI and Mage diff --git a/Mage.Tests/src/test/resources/log4j.properties b/Mage.Tests/src/test/resources/log4j.properties index fe23f19fc5..d7ff3a34aa 100644 --- a/Mage.Tests/src/test/resources/log4j.properties +++ b/Mage.Tests/src/test/resources/log4j.properties @@ -1,25 +1,29 @@ -#default levels -log4j.rootLogger=debug, console, file, watchdog +#default settings (uses for TESTS run) + +#default log level and active appenders (dest for logs) +log4j.rootLogger=info, console, logfile, watchdog log4j.logger.com.j256.ormlite=warn +#custom log level for java classes +#log4j.logger.com.j256.ormlite=warn +#log4j.logger.mage.player.ai=warn + #console log log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern=%-5p [%d{yyyy-MM-dd HH:mm [ss:SSS]}] %C{1}[%t]: %m%n +log4j.appender.console.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n log4j.appender.console.Threshold=info -#log4j.appender.console.Threshold=debug +#file log - without rolling +log4j.appender.logfile=org.apache.log4j.FileAppender +log4j.appender.logfile.layout=org.apache.log4j.PatternLayout +log4j.appender.logfile.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n +log4j.appender.logfile.File=magetest.log +log4j.appender.logfile.Threshold=info -#file log -log4j.appender.file=org.apache.log4j.FileAppender -log4j.appender.file.file=Mage.log -log4j.appender.file.layout=org.apache.log4j.PatternLayout -log4j.appender.file.layout.ConversionPattern=%-5p [%d{yyyy-MM-dd HH:mm [ss:SSS]}] %C{1}[%t]: %m%n -log4j.appender.file.Threshold=INFO - -#errors +#file log - errors only log4j.appender.watchdog=org.apache.log4j.FileAppender -log4j.appender.watchdog.file=watchdog.log log4j.appender.watchdog.layout=org.apache.log4j.PatternLayout log4j.appender.watchdog.layout.ConversionPattern=%-5p [%d{yyyy-MM-dd HH:mm [ss:SSS]}] %C{1}[%t]: %m%n -log4j.appender.watchdog.Threshold=ERROR \ No newline at end of file +log4j.appender.watchdog.file=magetestErrors.log +log4j.appender.watchdog.Threshold=error \ No newline at end of file diff --git a/Mage/src/main/java/mage/abilities/effects/common/RollPlanarDieEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RollPlanarDieEffect.java index f6452f7d54..dcd4a797d3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RollPlanarDieEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RollPlanarDieEffect.java @@ -1,7 +1,6 @@ package mage.abilities.effects.common; import java.util.List; -import java.util.logging.Logger; import java.util.stream.Collectors; import mage.MageObject; import mage.abilities.Ability; @@ -25,8 +24,6 @@ import mage.target.targetpointer.FixedTarget; */ public class RollPlanarDieEffect extends OneShotEffect { - private static final Logger log = Logger.getLogger("Roll Planar Die"); - protected List chaosEffects = null; protected List chaosTargets = null;