Sidebar

How to change qie log file location?

0 votes
844 views
asked Apr 29, 2019 by (330 points)
i want to change default location(C:\ProgramData\QIEStd\logs) of QIE log file to some other location . i tried many configurations in QIE Standard Service Manager but i am unable to find right configuration to change default log file location.

Thanks in advance.

2 Answers

+1 vote
 
Best answer

As of the .49 build, the log4j framework was updated to log4j2.  The updated framework uses a different syntax for the properties file.  As a result of this change QIE now uses the default log4j2 vm option to specify a custom configuration file.

Here is an example of the vm option:

 -Dlog4j.configurationFile=C:\somepath\log4j2.properties

Here is the standard QIE config as a sample:

# status - The level of internal Log4j events that should be logged to the console.  Set status="trace" to troubleshoot log4j.
status=error
# dest - Either "err" for stderr, "out" for stdout, a file path, or a URL.
dest=out
# name - The name of this configuration.  Note: not the file name but a name that can be used in code to reference this configuration.
name=QieLog4j2PropertiesConfig

# Direct log messages to stdout
appender.stdout.type=Console
appender.stdout.name=stdout
appender.stdout.target=SYSTEM_OUT
appender.stdout.layout.type=PatternLayout
appender.stdout.layout.pattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%t]%X{qieContext} %p %c - %m %x%n

# rollingfile
appender.rollingfile.type=RollingFile
appender.rollingfile.name=rollingfile
# NOTE: log4j 1.x had limited support for using variables (example: ${qie.home}).  Log4j 2.x adds a lot of options
#       (examples: ${sys:qie.home}, ${env:JAVA_HOME}).  See the documentation for other Lookups available:
#       https://logging.apache.org/log4j/2.0/manual/lookups.html
appender.rollingfile.fileName=${sys:qie.home}/logs/qie.log
appender.rollingfile.filePattern=${sys:qie.home}/logs/qie.log.%i
appender.rollingfile.layout.type=PatternLayout
appender.rollingfile.layout.pattern=%d{yyyy-MM-dd HH:mm:ss,SSS z} [%t]%X{qieContext} %p %c - %m %x%n
appender.rollingfile.policies.type=Policies
appender.rollingfile.policies.size.type=SizeBasedTriggeringPolicy
appender.rollingfile.policies.size.size=10MB
appender.rollingfile.strategy.type=DefaultRolloverStrategy
appender.rollingfile.strategy.fileIndex=min
appender.rollingfile.strategy.min=1
appender.rollingfile.strategy.max=4

# dicomrollingfile
appender.dicomrollingfile.type=RollingFile
appender.dicomrollingfile.name=dicomrollingfile
appender.dicomrollingfile.fileName=${sys:qie.home}/logs/dicom.log
appender.dicomrollingfile.filePattern=${sys:qie.home}/logs/dicom.log.%i
appender.dicomrollingfile.layout.type=PatternLayout
appender.dicomrollingfile.layout.pattern=%d{yyyy-MM-dd HH:mm:ss,SSS z} [%t]%X{qieContext} %p %c - %m %x%n
appender.dicomrollingfile.policies.type=Policies
appender.dicomrollingfile.policies.size.type=SizeBasedTriggeringPolicy
appender.dicomrollingfile.policies.size.size=10MB
appender.dicomrollingfile.strategy.type=DefaultRolloverStrategy
appender.dicomrollingfile.strategy.fileIndex=min
appender.dicomrollingfile.strategy.min=1
appender.dicomrollingfile.strategy.max=4

# autoUpdateLogFile
appender.autoUpdateLogFile.type=RollingFile
appender.autoUpdateLogFile.name=autoUpdateLogFile
appender.autoUpdateLogFile.fileName=${sys:qie.home}/logs/auto_update.log
appender.autoUpdateLogFile.filePattern=${sys:qie.home}/logs/auto_update.log.%i
appender.autoUpdateLogFile.layout.type=PatternLayout
appender.autoUpdateLogFile.layout.pattern=%d{yyyy-MM-dd HH:mm:ss,SSS z} [%t]%X{qieContext} %p %c - %m %x%n
appender.autoUpdateLogFile.policies.type=Policies
appender.autoUpdateLogFile.policies.size.type=SizeBasedTriggeringPolicy
appender.autoUpdateLogFile.policies.size.size=1MB
appender.autoUpdateLogFile.strategy.type=DefaultRolloverStrategy
appender.autoUpdateLogFile.strategy.fileIndex=min
appender.autoUpdateLogFile.strategy.min=1
appender.autoUpdateLogFile.strategy.max=4

# Root logger configuration
rootLogger.level=info
rootLogger.appenderRef.rollingfile.ref=rollingfile
rootLogger.appenderRef.stdout.ref=stdout

# Hibernate logging options (INFO only shows startup messages)
# https://docs.jboss.org/hibernate/orm/5.1/topical/html_single/logging/Logging.html
# https://thoughts-on-java.org/hibernate-logging-guide/
# https://medium.com/@scadge/how-to-enable-hibernate-logging-dc11545efd3d
# https://stackoverflow.com/questions/27088083/log4j2-jpa-hibernate-logging-is-not-working
logger.hibernate.name=org.hibernate
logger.hibernate.level=info
logger.hibernate.additivity=false
logger.hibernate.appenderRef.rollingfile.ref=rollingfile
logger.hibernate.appenderRef.stdout.ref=stdout

# Log JDBC bind parameter runtime arguments
logger.jdbc.name=org.hibernate.type.descriptor.sql
logger.jdbc.level=info
logger.jdbc.additivity=false
logger.jdbc.appenderRef.rollingfile.ref=rollingfile
logger.jdbc.appenderRef.stdout.ref=stdout

# Log hibernate deprecation warnings
logger.hibernateDeprecation.name=org.hibernate.orm.deprecation
logger.hibernateDeprecation.level=error
logger.hibernateDeprecation.additivity=false
logger.hibernateDeprecation.appenderRef.rollingfile.ref=rollingfile
logger.hibernateDeprecation.appenderRef.stdout.ref=stdout

# H2 logging
logger.H2.name=h2database
logger.H2.level=warn
logger.H2.additivity=false
logger.H2.appenderRef.rollingfile.ref=rollingfile
logger.H2.appenderRef.stdout.ref=stdout

# springframework (so that global changes to root logging don't cause extra static)
logger.springframework.name=org.springframework
logger.springframework.level=warn
logger.springframework.additivity=false
logger.springframework.appenderRef.rollingfile.ref=rollingfile
logger.springframework.appenderRef.stdout.ref=stdout

# Apache HttpComponents wire logging (so that global changes to root logging don't cause extra static)
logger.wire.name=org.apache.http.wire
logger.wire.level=warn
logger.wire.additivity=false
logger.wire.appenderRef.rollingfile.ref=rollingfile
logger.wire.appenderRef.stdout.ref=stdout

# our classes
logger.app.name=com.qvera
logger.app.level=debug
logger.app.additivity=false
logger.app.appenderRef.rollingfile.ref=rollingfile
logger.app.appenderRef.stdout.ref=stdout

# dcm4che3 classes
logger.dcm4che3.name=org.dcm4che3
logger.dcm4che3.level=debug
logger.dcm4che3.additivity=false
logger.dcm4che3.appenderRef.dicomrollingfile.ref=dicomrollingfile
logger.dcm4che3.appenderRef.stdout.ref=stdout

# autoUpdate classes
logger.autoUpdate.name=com.qvera.qie.utils.ChunkRetriever
logger.autoUpdate.level=trace
logger.autoUpdate.additivity=false
logger.autoUpdate.appenderRef.autoUpdateLogFile.ref=autoUpdateLogFile
logger.autoUpdate.appenderRef.stdout.ref=stdout

For more details see the log4j2 documentation:

https://logging.apache.org/log4j/2.x/manual/configuration.html

 

answered Feb 19, 2021 by rich-c-2789 (16,180 points)
commented Feb 19, 2021 by ben-s-7515 (12,320 points)
If you wanted to change the output from pattern to a JSON output, you will change each line that is:
appender.stdout.layout.type=PatternLayout
to
appender.stdout.layout.type=JsonLayout

and then commend out each line that is:
appender.stdout.layout.pattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%t]%X{qieContext} %p %c - %m %x%n

Now the logs will be in a JSON format instead of a single line pattern.
0 votes

As of the 46 build we have the ability for you to modify the log files. We use Log4j to manage the logs. You will need to create a configuration file and then pass that file in as a java option. 

Here is the standard QIE file:

# rollingfile
log4j.appender.rollingfile=org.apache.log4j.RollingFileAppender
log4j.appender.rollingfile.File=${qie.home}/logs/qie.log
log4j.appender.rollingfile.MaxFileSize=1MB
log4j.appender.rollingfile.MaxBackupIndex=9
log4j.appender.rollingfile.layout=org.apache.log4j.PatternLayout
log4j.appender.rollingfile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS z} [%t]%X{qieContext} %p %c - %m %x%n

# Root logger option
log4j.rootLogger=WARN, rollingfile

# Hibernate logging options (INFO only shows startup messages)
log4j.logger.org.hibernate=WARN

# Log JDBC bind parameter runtime arguments
log4j.logger.org.hibernate.type=WARN

# H2 logging
log4j.logger.h2database=WARN

# our classes
log4j.logger.com.qvera=WARN

The java option you will add is the following:

-Dqie.log4j.configuration=C:\somepath\log4j.cfg 

(file name can be set to whatever you saved your config file as.

answered Apr 29, 2019 by brandon-w-8204 (33,170 points)
asked Apr 30, 2019 by (330 points) How to create log4j logging file with custom logs?
...