[Release] Server shutdown and start log.
Put this method in WorldServer:
Code:
private static void logServer(String reason) {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = null;
try {
ps = con.prepareStatement("INSERT INTO serverlog VALUES (DEFAULT, ?, DEFAULT)");
ps.setString(1, reason);
ps.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
System.err.print("Failed loging date into serverlog.");
} finally {
if (ps != null) {
try {
ps.close();
} catch (SQLException se) {
se.printStackTrace();
System.err.print("Failed closing SQL Session while loging server.");
}
}
System.out.print("Server start has been logged.\r\n");
}
}
In the "main" method in WorldServer put this:
Code:
logServer("Server started.");
Below that put this:
Code:
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
logServer("Server shutdown.");
}
});
And then execute this SQL:
Code:
--
-- Definition of table `serverlog`
--
DROP TABLE IF EXISTS `serverlog`;
CREATE TABLE `serverlog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`reason` varchar(50) DEFAULT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Now whenever the server is shutdown or started it will be logged into the "serverlog" table.
Afterward if you have errors try right click, fix imports in Netbeans.
Re: [Release] Server shutdown and start log.
Re: [Release] Server shutdown and start log.
I meant in WorldServer, sorry.
Re: [Release] Server shutdown and start log.
Re: [Release] Server shutdown and start log.
Just makes odinms more shitter in performance.
Re: [Release] Server shutdown and start log.
Quote:
Originally Posted by
LameJacob
This is useless.
Yeah, whatever, I just made this for my server to keep track of server restarts.
---------- Post added at 11:22 PM ---------- Previous post was at 11:21 PM ----------
Quote:
Originally Posted by
Raymond.C
Just makes odinms more shitter in performance.
It runs a simple query on the start of the server and it carries on nothing more.
Know what you're saying before you post please.
Re: [Release] Server shutdown and start log.
Quote:
Originally Posted by
Raymond.C
Just makes odinms more shitter in performance.
like you know anything about performance.
lol it doesn't even seem like you know what you're talking about. how is this not very efficient?
Re: [Release] Server shutdown and start log.
maybe shiter performance because you losers host it on ur computer with other shit downloaded with lags the server form start and if u add this u might just crash.
Like you know everything rite?
Re: [Release] Server shutdown and start log.
Re: [Release] Server shutdown and start log.
Quote:
Originally Posted by
ZixEx_
maybe shiter performance because you losers host it on ur computer with other shit downloaded with lags the server form start and if u add this u might just crash.
Like you know everything rite?
TBH, You don't know wtf you're talking about neither.
Re: [Release] Server shutdown and start log.
Quote:
Originally Posted by
Raymond.C
Just makes odinms more shitter in performance.
Idiot talking out of his ass alert.
Re: [Release] Server shutdown and start log.
I don't get why you need this at all. I also don't understand why people thing running a query will lessen performance. If it does in your server, how the hell do you expect to even load a character from the database?
Re: [Release] Server shutdown and start log.
Quote:
Originally Posted by
Red Tape
I also don't understand why people thing running a query will lessen performance. If it does in your server, how the hell do you expect to even load a character from the database?
They just don't get that Java reuses memory.
Re: [Release] Server shutdown and start log.
I don't find a really nice idea in the usage of this, but it's not bad. Nice job Rich ;D.
Re: [Release] Server shutdown and start log.
I will be looking forward for this, thanks.