commit 22/01/2026
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#Configuration saved on 2026-01-22T13:49:56.778957100
|
||||
#Thu Jan 22 13:49:56 WIB 2026
|
||||
#Configuration saved on 2026-01-22T15:17:06.581736300
|
||||
#Thu Jan 22 15:17:06 WIB 2026
|
||||
activemq_brokerurl=tcp\://localhost\:61616
|
||||
activemq_password=admin
|
||||
activemq_queuename=TEST.QUEUE
|
||||
|
||||
@@ -9,7 +9,7 @@ $(document).ready(function() {
|
||||
});
|
||||
});
|
||||
|
||||
$(window).on('beforeunload', function() {
|
||||
$(window).on('unload', function() {
|
||||
console.log("User is leaving home.html");
|
||||
// Your cleanup code here
|
||||
});
|
||||
@@ -19,7 +19,7 @@ $(document).ready(function() {
|
||||
});
|
||||
});
|
||||
|
||||
$(window).on('beforeunload', function() {
|
||||
$(window).on('unload', function () {
|
||||
console.log("User is leaving log.html");
|
||||
// Your cleanup code here
|
||||
});
|
||||
@@ -29,7 +29,40 @@ function GetLog(date = new Date().toISOString().split('T')[0]) {
|
||||
console.log("Fetching logs for date: " + date);
|
||||
Get('getLogs?' + new URLSearchParams({ date: date }).toString(), function (data) {
|
||||
console.log(data);
|
||||
fill_table(data);
|
||||
}, function (error) {
|
||||
fill_table(null);
|
||||
alert(error);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} logdata
|
||||
* @property {number} index Index number of the log entry
|
||||
* @property {string} date Date string in format dd/mm/yyyy
|
||||
* @property {string} time Time string in format HH:MM:SS
|
||||
* @property {string} function Function name where the log was generated
|
||||
* @property {string} message Log message
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fill table with logdata
|
||||
* @param {logdata[]} data
|
||||
*/
|
||||
function fill_table(data) {
|
||||
let $logtablebody = $('#logtablebody');
|
||||
$logtablebody.empty();
|
||||
if (data && Array.isArray(data) && data.length > 0) {
|
||||
data.forEach(function (logentry) {
|
||||
let row = `<tr>
|
||||
<td>${logentry.index}</td>
|
||||
<td>${logentry.date}</td>
|
||||
<td>${logentry.time}</td>
|
||||
<td>${logentry.function}</td>
|
||||
<td>${logentry.message}</td>
|
||||
</tr>`;
|
||||
$logtablebody.append(row);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,7 +7,7 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
$(window).on('beforeunload', function() {
|
||||
$(window).on('unload', function() {
|
||||
console.log("User is leaving login.html");
|
||||
// Your cleanup code here
|
||||
});
|
||||
@@ -20,7 +20,7 @@ $(document).ready(function () {
|
||||
});
|
||||
});
|
||||
|
||||
$(window).on('beforeunload', function () {
|
||||
$(window).on('unload', function () {
|
||||
console.log("User is leaving setting.html");
|
||||
// Your cleanup code here
|
||||
});
|
||||
|
||||
@@ -30,10 +30,10 @@
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-1">No</th>
|
||||
<th class="col-2">Date</th>
|
||||
<th class="col-2">Time</th>
|
||||
<th class="col-2">Category</th>
|
||||
<th class="col-sm-1">No</th>
|
||||
<th class="col-sm-2 col-lg-1">Date</th>
|
||||
<th class="col-sm-2 col-lg-1">Time</th>
|
||||
<th class="col-sm-2 col-lg-2">Category</th>
|
||||
<th>Message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.io.FileInputStream
|
||||
import java.io.FileNotFoundException
|
||||
import java.io.FileOutputStream
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import java.time.LocalDateTime
|
||||
import java.util.Properties
|
||||
import kotlin.io.path.Path
|
||||
@@ -12,7 +13,8 @@ import kotlin.io.path.Path
|
||||
@Suppress("unused")
|
||||
class Config {
|
||||
private val prop = Properties()
|
||||
private val filename = "config.properties"
|
||||
// config.properties is saved in current working directory
|
||||
private val filename = Paths.get(System.getProperty("user.dir"), "config.properties")
|
||||
var WebPort : Int
|
||||
get() = prop.getProperty("webport").toInt()
|
||||
set(value) {prop.setProperty("webport", value.toString())}
|
||||
@@ -64,24 +66,24 @@ class Config {
|
||||
|
||||
fun Load(){
|
||||
try{
|
||||
if (Files.isRegularFile(Path(filename))){
|
||||
prop.load(FileInputStream(filename))
|
||||
if (!prop.contains("webport")) throw Exception("Invalid config file: missing 'webport'")
|
||||
if (!prop.contains("webusername")) throw Exception("Invalid config file: missing 'webusername'")
|
||||
if (!prop.contains("webpassword")) throw Exception("Invalid config file: missing 'webpassword'")
|
||||
if (!prop.contains("activemq_brokerurl")) throw Exception("Invalid config file: missing 'activemq_brokerurl'")
|
||||
if (!prop.contains("activemq_username")) throw Exception("Invalid config file: missing 'activemq_username'")
|
||||
if (!prop.contains("activemq_password")) throw Exception("Invalid config file: missing 'activemq_password'")
|
||||
if (!prop.contains("activemq_queuename")) throw Exception("Invalid config file: missing 'activemq_queuename'")
|
||||
if (!prop.contains("mysql_aas1")) throw Exception("Invalid config file: missing 'mysql_aas1'")
|
||||
if (!prop.contains("mysql_aas2")) throw Exception("Invalid config file: missing 'mysql_aas2'")
|
||||
if (!prop.contains("mysql_aas3")) throw Exception("Invalid config file: missing 'mysql_aas3'")
|
||||
if (!prop.contains("mysql_aas1_username")) throw Exception("Invalid config file: missing 'mysql_aas1_username'")
|
||||
if (!prop.contains("mysql_aas1_password")) throw Exception("Invalid config file: missing 'mysql_aas1_password'")
|
||||
if (!prop.contains("mysql_aas2_username")) throw Exception("Invalid config file: missing 'mysql_aas2_username'")
|
||||
if (!prop.contains("mysql_aas2_password")) throw Exception("Invalid config file: missing 'mysql_aas2_password'")
|
||||
if (!prop.contains("mysql_aas3_username")) throw Exception("Invalid config file: missing 'mysql_aas3_username'")
|
||||
if (!prop.contains("mysql_aas3_password")) throw Exception("Invalid config file: missing 'mysql_aas3_password'")
|
||||
if (Files.isRegularFile(filename)){
|
||||
prop.load(FileInputStream(filename.toString()))
|
||||
if (!prop.containsKey("webport")) throw Exception("Invalid config file: missing 'webport'")
|
||||
if (!prop.containsKey("webusername")) throw Exception("Invalid config file: missing 'webusername'")
|
||||
if (!prop.containsKey("webpassword")) throw Exception("Invalid config file: missing 'webpassword'")
|
||||
if (!prop.containsKey("activemq_brokerurl")) throw Exception("Invalid config file: missing 'activemq_brokerurl'")
|
||||
if (!prop.containsKey("activemq_username")) throw Exception("Invalid config file: missing 'activemq_username'")
|
||||
if (!prop.containsKey("activemq_password")) throw Exception("Invalid config file: missing 'activemq_password'")
|
||||
if (!prop.containsKey("activemq_queuename")) throw Exception("Invalid config file: missing 'activemq_queuename'")
|
||||
if (!prop.containsKey("mysql_aas1")) throw Exception("Invalid config file: missing 'mysql_aas1'")
|
||||
if (!prop.containsKey("mysql_aas2")) throw Exception("Invalid config file: missing 'mysql_aas2'")
|
||||
if (!prop.containsKey("mysql_aas3")) throw Exception("Invalid config file: missing 'mysql_aas3'")
|
||||
if (!prop.containsKey("mysql_aas1_username")) throw Exception("Invalid config file: missing 'mysql_aas1_username'")
|
||||
if (!prop.containsKey("mysql_aas1_password")) throw Exception("Invalid config file: missing 'mysql_aas1_password'")
|
||||
if (!prop.containsKey("mysql_aas2_username")) throw Exception("Invalid config file: missing 'mysql_aas2_username'")
|
||||
if (!prop.containsKey("mysql_aas2_password")) throw Exception("Invalid config file: missing 'mysql_aas2_password'")
|
||||
if (!prop.containsKey("mysql_aas3_username")) throw Exception("Invalid config file: missing 'mysql_aas3_username'")
|
||||
if (!prop.containsKey("mysql_aas3_password")) throw Exception("Invalid config file: missing 'mysql_aas3_password'")
|
||||
Logger.info { "Configuration loaded from config.properties" }
|
||||
} else throw FileNotFoundException("Config file not found")
|
||||
} catch (e: FileNotFoundException){
|
||||
@@ -102,7 +104,7 @@ class Config {
|
||||
// comment is save date and time
|
||||
val comment = "Configuration saved on ${LocalDateTime.now()}"
|
||||
try{
|
||||
prop.store(FileOutputStream(filename), comment)
|
||||
prop.store(FileOutputStream(filename.toString()), comment)
|
||||
Logger.info { "Configuration saved to config.properties" }
|
||||
} catch (ex: Exception){
|
||||
Logger.error(ex) { "Error while saving config, Message : ${ex.message}" }
|
||||
|
||||
2
src/simplelogger.properties
Normal file
2
src/simplelogger.properties
Normal file
@@ -0,0 +1,2 @@
|
||||
# gak mau lihat log javalin
|
||||
org.slf4j.simpleLogger.defaultLogLevel=error
|
||||
Reference in New Issue
Block a user