Skip to content

Commit

Permalink
Merge pull request #1 from adamkorynta/move_logging_properties
Browse files Browse the repository at this point in the history
move logging.properties out of resources
  • Loading branch information
wjonassen authored Jan 17, 2024
2 parents fc5c06d + 47b0e83 commit 2740c1c
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 10 deletions.
14 changes: 4 additions & 10 deletions opendcs-rest-api-jetty/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,20 @@ task createStartScript() {
new File(binDir, "start.sh").text = """
#!/bin/bash
cd `dirname \$0`/..
java -Djava.util.logging.config.file=logging.properties \$JAVA_OPTS -jar libs/${project.name}-${project.version}.jar \$JAVA_ARGS
java -Djava.util.logging.config.file=config/logging.properties \$JAVA_OPTS -jar libs/${project.name}-${project.version}.jar \$JAVA_ARGS
"""
}
}

task copyLoggingPropertiesFile(type: Copy) {
dependsOn jar
from 'src/main/resources/logging.properties'
into project.layout.getBuildDirectory().get().getAsFile()
}

task bundle(type: Tar) {
dependsOn jar
dependsOn createStartScript
dependsOn copyLoggingPropertiesFile

compression Compression.GZIP
archiveExtension = 'tar.gz'

into('') {
from new File(project.layout.getBuildDirectory().get().getAsFile(), "logging.properties");
into('config') {
from project.file("bin/logging.properties")
}
into('libs') {
from configurations.runtimeClasspath
Expand Down
77 changes: 77 additions & 0 deletions opendcs-rest-api-jetty/config/logging.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#
# Copyright 2024 OpenDCS Consortium
#
# 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
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

############################################################
# Default Logging Configuration File
#
# You can use a different file by specifying a filename
# with the java.util.logging.config.file system property.
# For example java -Djava.util.logging.config.file=myfile
# or: -Djava.util.logging.config.file=./config/properties/logging.properties
############################################################

############################################################
# Global properties
############################################################

# "handlers" specifies a comma separated list of log Handler
# classes. These handlers will be installed during VM startup.
# Note that these classes must be on the system classpath.
# Additional handlers can be added to the list
handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler

# Default global logging level.
# This specifies which kinds of events are logged across
# all loggers. For any given facility this global level
# can be overriden by a facility specific level
# Note that the ConsoleHandler also has a separate level
# setting to limit messages printed to the console.
.level= CONFIG

############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################

# Individual handlers filter messages by level.
# Messages at or above this level get output by the handler being configured.

# Setting this level = CONFIG causes CONFIG, INFO, WARNING, and SEVERE messages to be
# output by this handler.
java.util.logging.ConsoleHandler.level = CONFIG
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

# The following special tokens can be used in the FileHandler pattern property
# which specifies the location and name of the log file.
# / - standard path separator
# %t - system temporary directory
# %h - value of the user.home system property
# %g - generation number for rotating logs
# %u - unique number to avoid conflicts
# FileHandler writes to %h/demo0.log by default.
java.util.logging.FileHandler.pattern = %t/opendcs_rest_logging_%g.log
java.util.logging.FileHandler.level = ALL
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter

# Formats the messages with a timestamp at the beginning.
java.util.logging.SimpleFormatter.format=[%1$tc] %4$s: %5$s %n

############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################

# Specify logging levels for specific namespaces.
# org.opendcs.odcsapi.level = FINEST

0 comments on commit 2740c1c

Please sign in to comment.