Chat Tutorial in NetBeans/Server: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>SimonSmall
added Category NetBeans
imported>Hendrik Brummermann
World.java: added missing call to world.initialize() as reported by maxgmer
 
(14 intermediate revisions by one other user not shown)
Line 17: Line 17:
There are a few choices to be made about the configuration of our server. They are covered below, so make sure that you are reading the correct instructions.
There are a few choices to be made about the configuration of our server. They are covered below, so make sure that you are reading the correct instructions.


* This example is using the h2 database to store data. This uses a single file for storing the data, and does not need login credentials. You need to decide where the database file will be stored. MySQL can also be used but this is not covered here; you may need this if there is more to be stored in the database, or if you want a different security model.
* This example is using the h2 database to store data. This uses a single file for storing the data, and does not need login credentials. You need to decide where the database file will be stored. This configuration is referred to as an embedded h2 database. It is further restricted by being single user access, meaning the server becomes that single user and you cannot access the database when the server is running.

* MySQL can also be used but this is covered in the [[Chat Tutorial in NetBeans/MySQL]] page; you may need this if there is more to be stored in the database, or if you want a different security model. This will allow the database to be examined when the server is running.


* The server and client code can be written and linked to the Marauroa engine as a jar file or as a NetBeans project if you have the source code. This choice affects the actions you must take.
* The server and client code can be written and linked to the Marauroa engine as a jar file or as a NetBeans project if you have the source code. This choice affects the actions you must take.
Line 55: Line 57:
if (instance == null) {
if (instance == null) {
instance = new World();
instance = new World();
instance.initialize()
}
}
return instance;
return instance;
Line 263: Line 266:
turn_length=300
turn_length=300
statistics_filename=server_stats.xml
statistics_filename=server_stats.xml
log4j_url=log4j.properties
log4j_url=log4j_server.properties


# World and RP configuration
# World and RP configuration
Line 307: Line 310:
Although you don't have to provide a Log configuration file, you can if you wish.
Although you don't have to provide a Log configuration file, you can if you wish.


Create another empty file, as you did with the '''server.ini''' file, with a name of '''log4j.properties''' and copy the following code into it (NetBeans remembers the file types you created, so Empty will be on the first selection screen)
Create another empty file, as you did with the '''server.ini''' file, with a name of '''log4j_server.properties''' and copy the following code into it (NetBeans remembers the file types you created, so Empty will be on the first selection screen)


<pre>
<pre>
# Set root logger level to DEBUG and its only appender to A1.
# Set root logging level to INFO, and create two output configurations
log4j.rootLogger=INFO, Console, File
log4j.rootLogger=INFO, Console, File


# Paste all logger entries with a threshold of WARN to the console
# Paste all log entries to the console
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%-4r %-5p %c %x - %m%n
log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c - %m%n


# Paste all log entries to a daily log file
log4j.appender.File=org.apache.log4j.DailyRollingFileAppender
log4j.appender.File=org.apache.log4j.DailyRollingFileAppender
log4j.appender.File.File=log/server.log
log4j.appender.File.File=log/server.log
log4j.appender.File.layout=org.apache.log4j.PatternLayout
log4j.appender.File.layout=org.apache.log4j.PatternLayout
log4j.appender.File.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
log4j.appender.File.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c - %m%n


# Set priority to warning messages and above, disabling debug and info messages
# Disabled debug messages... to avoid too many logs
log4j.logger.marauroa.server.game.RPServerManager=WARN
log4j.logger.marauroa.server.game.RPServerManager=WARN
</pre>
</pre>