Skip to content

Instantly share code, notes, and snippets.

View jamezp's full-sized avatar

James R. Perkins jamezp

  • Red Hat
  • Government Camp, OR
View GitHub Profile
@jamezp
jamezp / Example.java
Last active October 2, 2018 16:17
Example Log Configuration Change Updater
/*
* JBoss, Home of Professional Open Source.
*
* Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
# Additional loggers to configure (the root logger is always configured)
#loggers=org.hibernate
logger.level=INFO
logger.handlers=CONSOLE,FILE
#logger.org.hibernate.level=DEBUG
handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
handler.CONSOLE.level=INFO

Messages

Table 1. org.jboss.as.server.logging.ServerLogger
Message Id Message Log Level Return Type
@echo off
for /l %%x in (1, 1, 10) do (
setlocal enabledelayedexpansion
echo Executing run %%x for command %*
call %*
if not !errorlevel! == 0 (
echo Command %* failed at run %%x with status !errorlevel!
exit /b !errorlevel!
)
module add --name=com.mysql --resources=~/Downloads/mysql-connector-java-5.1.37/mysql-connector-java-5.1.37-bin.jar --dependencies=javax.api,javax.transaction.api
batch
/subsystem=datasources/jdbc-driver=com.mysql:add(driver-name=com.mysql, driver-module-name=com.mysql, driver-xa-datasource-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource)
/subsystem=datasources/xa-data-source=mysql:add(driver-name=com.mysql, jndi-name="java:/jdbc/MySQLXA", enabled=true)
/subsystem=datasources/xa-data-source=mysql/xa-datasource-properties=URL:add(value="jdbc:mysql://localhost:3306/temp?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8")
run-batch

JBoss Log Manager Configuration

Options

  • Logger options

    • loggers=<category>[,<category>,…​] - Specify a comma-separated list of logger categories which will be configured. Any categories not listed here will not be configured from the following properties.

    • logger.<category>.level=<level> - Specify the level for a category. The level can be one of the valid levels. If unspecified, the nearest parent’s level will be inherited.

    • logger.<category>.handlers=<handler>[,<handler>,…​] - Specify a comma-separated list of the handler names to attach to this logger. The handlers must be configured in the same properties file.

    • logger.<category>.filter=<filter> - Specify a filter for a category. See the filter expressions for details on defining a filter.

    • logger.<category>.useParentHandlers=(true|false) - Specify whether log messages should cascade up to parent handlers. The default value is true.

module add --name=org.postgresql --resources=~/Downloads/postgresql-42.3.3.jar --dependencies=java.desktop,java.logging,java.management,java.naming,java.security.jgss,java.security.sasl,java.sql,java.transaction.xa,java.xml
batch
/subsystem=datasources/jdbc-driver=org.postgresql:add(driver-name=org.postgresql, driver-module-name=org.postgresql, driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource)
/subsystem=datasources/data-source=postgresql:add(driver-name=org.postgresql, jndi-name="java:/jdbc/PostgresDS", enabled=true, connection-url="jdbc:postgresql://localhost/test")
run-batch
# Add the postgres module
module add --name=org.postgresql --resources=~/Downloads/postgresql-9.4-1203.jdbc42.jar --dependencies=javax.api,javax.transaction.api
# Add the driver
/subsystem=datasources/jdbc-driver=postgresql:add(driver-module-name=org.postgresql, driver-name=postgresql)
# Add the data-source
subsystem=datasources/data-source=test:add(jndi-name=java:jboss/datasources/TestDS, connection-url=jdbc:postgresql://localhost:5432/test-db, driver-name=postgresql, user-name=user, password=password)