@@ -29,7 +29,7 @@ public static void main(String[] args) throws Exception {
2929 String [] dim = arg .split ("=" );
3030 parseFile (dim [1 ]);
3131 break ;
32- }else {
32+ } else {
3333 System .err .println ("are you sure ? -f not -f=file ! it not can use!" );
3434 }
3535 }
@@ -50,8 +50,8 @@ public static void main(String[] args) throws Exception {
5050 ENV_MAP .put (PREFIX + "maven" , dim [1 ]);
5151 }
5252 }
53- }else if (!arg .startsWith ("-f" )){
54- System .err .println ("arg : " + arg +" can use ! not find = over it " );
53+ } else if (!arg .startsWith ("-f" )) {
54+ System .err .println ("arg : " + arg + " can use ! not find = over it " );
5555 }
5656 }
5757
@@ -63,11 +63,11 @@ public static void main(String[] args) throws Exception {
6363 int port = Integer .parseInt (getOrCreateEnv (PREFIX + "port" , "8080" ));
6464
6565 System .setProperty ("java.awt.headless" , "true" ); //support kaptcha
66-
66+
6767 Server server = new Server (port );
68-
68+
6969 ProtectionDomain domain = Bootstrap .class .getProtectionDomain ();
70-
70+
7171 URL location = domain .getCodeSource ().getLocation ();
7272
7373 WebAppContext context = new WebAppContext ();
@@ -92,9 +92,9 @@ public static void main(String[] args) throws Exception {
9292 } else {
9393 context .setWar ("src/main/webapp" );
9494 }
95-
95+
9696 server .setHandler (context );
97-
97+
9898 server .start ();
9999 server .join ();
100100 }
@@ -108,12 +108,16 @@ public static void main(String[] args) throws Exception {
108108 */
109109 private static void createLog4jConfig (File log4jFile , String logPath ) throws FileNotFoundException , IOException {
110110
111+ if (log4jFile .exists ()) {
112+ return ;
113+ }
114+
111115 StringBuilder sb = new StringBuilder ();
112116
113- sb .append (
114- "log4j.rootLogger=info, stdout,R \n " + "log4j.appender.stdout=org.apache.log4j.ConsoleAppender\n " + "log4j.appender.stdout.layout=org.apache.log4j.PatternLayout \n "
115- + "log4j.appender.stdout.layout.ConversionPattern=%c-%-4r %-5p [%d{yyyy-MM-dd HH:mm:ss}] %m%n\n " + "\n "
116- + "log4j.appender.R=org.apache.log4j.DailyRollingFileAppender\n " + "log4j.appender.R.File=" );
117+ sb .append ("log4j.rootLogger=info, stdout,R \n " + "log4j.appender.stdout.Encoding=UTF-8 \n " + "log4j.appender.R.Encoding=UTF-8 \n "
118+ + "log4j.appender.stdout=org.apache.log4j.ConsoleAppender\n " + "log4j.appender.stdout.layout=org.apache.log4j.PatternLayout \n "
119+ + "log4j.appender.stdout.layout.ConversionPattern=%c-%-4r %-5p [%d{yyyy-MM-dd HH:mm:ss}] %m%n\n " + "\n "
120+ + "log4j.appender.R=org.apache.log4j.DailyRollingFileAppender\n " + "log4j.appender.R.File=" );
117121
118122 sb .append (logPath );
119123
@@ -170,12 +174,11 @@ private static void makeFiles(File JcoderHome, String logPath) throws FileNotFou
170174 + " <defaultGoal>compile</defaultGoal>\n " + " </build>\n " + "</project>" );
171175 }
172176
173-
174177 File tmpDir = new File (JcoderHome , "tmp" ); // create tmp dir
175178 if (!tmpDir .exists ()) {
176179 tmpDir .mkdirs ();
177180 }
178-
181+
179182 File pluginDir = new File (JcoderHome , "plugins" ); // create tmp dir
180183 if (!pluginDir .exists ()) {
181184 pluginDir .mkdirs ();
@@ -186,7 +189,7 @@ private static void makeFiles(File JcoderHome, String logPath) throws FileNotFou
186189 if (!resourceDir .exists ()) {
187190 resourceDir .mkdirs ();
188191 }
189-
192+
190193 File iocFile = new File (JcoderHome , "/resource/ioc.js" ); // create ioc file
191194 if (!iocFile .exists ()) {
192195 wirteFile (iocFile .getAbsolutePath (), "utf-8" , "var ioc = {\n \n };" );
0 commit comments