diff --git a/.gitignore b/.gitignore index 5d7032f..993ec6b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ # Project directories arm_am*/ asset-gui/ +CustomLogFormatter/build.properties +CustomLogFormatter/custom-formatter.jar +CustomLogFormatter/build diff --git a/config.json b/config.json index 8519d49..fd76153 100644 --- a/config.json +++ b/config.json @@ -3,10 +3,7 @@ "deploymentDir": "C:\\Dev2012\\BUILDERS\\jboss-eap-7.4\\standalone\\deployments", "javaHome": "C:\\Dev2012\\BUILDERS\\java\\jdk1.8.0_291", "jboss": { - "configFile": "standalone\\configuration\\standalone-ADVC-full.xml", - "modules": { - "logmanager": "modules\\system\\layers\\base\\org\\jboss\\logmanager\\main" - } + "configFile": "standalone\\configuration\\standalone-ADVC-full.xml" }, "customFormatter": { "src": "src", diff --git a/config/standalone-ADVC-full.xml b/config/standalone-ADVC-full.xml new file mode 100644 index 0000000..e8add3e --- /dev/null +++ b/config/standalone-ADVC-full.xml @@ -0,0 +1,631 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + h2 + + sa + sa + + + + jdbc:postgresql://localhost:5432/advc?currentSchema=advc_own + postgresql + + bes2 + Armu4010 + + + select 1 + true + 300000 + + + 5 + + + + + org.h2.jdbcx.JdbcDataSource + + + org.postgresql.Driver + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${jboss.bind.address:127.0.0.1} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/com/armundia/advc360/bes/startup/main/build.xml b/modules/com/armundia/advc360/bes/startup/main/build.xml deleted file mode 100644 index 16656d2..0000000 --- a/modules/com/armundia/advc360/bes/startup/main/build.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/com/armundia/advc360/bes/startup/main/build/classes/com/armundia/adv360/bes/startup/CustomLogFormatter.class b/modules/com/armundia/advc360/bes/startup/main/build/classes/com/armundia/adv360/bes/startup/CustomLogFormatter.class deleted file mode 100644 index c94c3a2..0000000 Binary files a/modules/com/armundia/advc360/bes/startup/main/build/classes/com/armundia/adv360/bes/startup/CustomLogFormatter.class and /dev/null differ diff --git a/modules/com/armundia/advc360/bes/startup/main/custom-formatter.jar b/modules/com/armundia/advc360/bes/startup/main/custom-formatter.jar deleted file mode 100644 index 52dc0b3..0000000 Binary files a/modules/com/armundia/advc360/bes/startup/main/custom-formatter.jar and /dev/null differ diff --git a/modules/com/armundia/advc360/bes/startup/main/module.xml b/modules/com/armundia/advc360/bes/startup/main/module.xml deleted file mode 100644 index 6b2693f..0000000 --- a/modules/com/armundia/advc360/bes/startup/main/module.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/modules/com/armundia/advc360/bes/startup/main/src/com/armundia/adv360/bes/startup/CustomLogFormatter.java b/modules/com/armundia/advc360/bes/startup/main/src/com/armundia/adv360/bes/startup/CustomLogFormatter.java deleted file mode 100644 index 9c476ef..0000000 --- a/modules/com/armundia/advc360/bes/startup/main/src/com/armundia/adv360/bes/startup/CustomLogFormatter.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.armundia.adv360.bes.startup; - -import java.util.logging.Formatter; -import java.util.logging.LogRecord; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; - -public class CustomLogFormatter extends Formatter { - - private static final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss,SSS"); - - private String stripXMLTags(String input) { - if (input == null || input.isEmpty()) { - return input; - } - return input.replaceAll("<[^>]*>", ""); - } - - @Override - public String format(LogRecord record) { - StringBuilder sb = new StringBuilder(); - - // Data e ora - sb.append(ZonedDateTime.now().format(dateFormatter)) - .append(" "); - - // Livello log padded a 5 caratteri - String level = record.getLevel().toString(); - sb.append(String.format("%-5s", level)); - - // Nome classe - sb.append("[") - .append(record.getSourceClassName()) - .append("] "); - - // Thread - sb.append("(") - .append(Thread.currentThread().getName()) - .append(") "); - - // Messaggio - String message = formatMessage(record); - sb.append(stripXMLTags(message)); - - // Stack trace se presente - if (record.getThrown() != null) { - sb.append("\n"); - for (StackTraceElement element : record.getThrown().getStackTrace()) { - sb.append("\tat ") - .append(element.toString()) - .append("\n"); - } - } - - sb.append("\n"); - return sb.toString(); - } -} diff --git a/start-jboss.ps1 b/start-jboss.ps1 index fae6756..a8f11d7 100644 --- a/start-jboss.ps1 +++ b/start-jboss.ps1 @@ -26,13 +26,6 @@ if (-not (Test-Path $JBOSS_HOME)) { exit 1 } -# Check if configuration file exists -$configFile = Join-Path $JBOSS_HOME $config.jboss.configFile -if (-not (Test-Path $configFile)) { - Write-Host "Error: Configuration file not found at $configFile" -ForegroundColor Red - exit 1 -} - # Set environment variables $env:JAVA_HOME = $JAVA_HOME $env:JBOSS_HOME = $JBOSS_HOME @@ -41,6 +34,17 @@ $env:NOPAUSE = "true" # Remove this as it might affect logging # $env:LAUNCH_JBOSS_IN_BACKGROUND = "true" +# Set configuration file +$configFile = "standalone-ADVC-full.xml" + +# Copy configuration file from local config directory +$sourceConfig = "$PSScriptRoot\config\$configFile" +$targetConfig = "$JBOSS_HOME\standalone\configuration\$configFile" +if (Test-Path $sourceConfig) { + Write-Host "Copying configuration file from $sourceConfig to $targetConfig" -ForegroundColor Yellow + Copy-Item -Path $sourceConfig -Destination $targetConfig -Force +} + # Check if JBoss is already running if (Test-JBossRunning) { Write-Host "JBoss is already running!" -ForegroundColor Yellow @@ -50,11 +54,10 @@ if (Test-JBossRunning) { Write-Host "Starting JBoss EAP 7.4..." -ForegroundColor Green Write-Host "Using Java from: $JAVA_HOME" -ForegroundColor Yellow Write-Host "JBoss Home: $JBOSS_HOME" -ForegroundColor Yellow -Write-Host "Using configuration: $($config.jboss.configFile)" -ForegroundColor Yellow +Write-Host "Using configuration: $configFile" -ForegroundColor Yellow -# Start JBoss in standalone mode -$startScript = Join-Path $JBOSS_HOME "bin\standalone.bat" -$jvmOptions = @( +# Set JVM options +$jvmOpts = @( "-DIDServer=GS", "-Dbtf.PathToParse=C:\Dev2012\advc0\in", "-Djava.awt.headless=true", @@ -66,20 +69,16 @@ $jvmOptions = @( "-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n" ) -# Add JVM options to JAVA_OPTS -$env:JAVA_OPTS = "$($jvmOptions -join ' ')" - -Write-Host "Starting JBoss with custom JVM options..." -ForegroundColor Green -Write-Host "JVM Options: $env:JAVA_OPTS" -ForegroundColor Yellow -Write-Host "Remote debugging enabled on port 8787" -ForegroundColor Cyan +Write-Host "Starting JBoss with custom JVM options..." -ForegroundColor Yellow +Write-Host "JVM Options: $($jvmOpts -join ' ')" -ForegroundColor Gray # Create the command line arguments -$cmdArgs = "-c $($config.jboss.configFile) --debug -b 0.0.0.0 -bmanagement 0.0.0.0" +$cmdArgs = "-c $configFile --debug -b 0.0.0.0 -bmanagement 0.0.0.0" # Start JBoss - Modified to use Start-Process with RedirectStandardOutput $logFile = Join-Path $JBOSS_HOME "standalone\log\server.log" $processStartInfo = @{ - FilePath = $startScript + FilePath = Join-Path $JBOSS_HOME "bin\standalone.bat" ArgumentList = $cmdArgs RedirectStandardOutput = $logFile RedirectStandardError = Join-Path $JBOSS_HOME "standalone\log\server_error.log" @@ -88,6 +87,7 @@ $processStartInfo = @{ PassThru = $true } +Write-Host "Remote debugging enabled on port 8787" -ForegroundColor Yellow Write-Host "Starting JBoss and redirecting output to $logFile" -ForegroundColor Yellow $jbossProcess = Start-Process @processStartInfo