How to set application logging properties

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to set application logging properties

ruperty
In development (for a NPA) to get the java logging to appear in the Application Log I set jvm args with


> -J-Dnetbeans.logger.console=true -J-ea


This also displays in the IDE console and writes log messages to a file at build\testuserdir\var\log\messages.log. (What is -J-ea?)

But the format and filtering is not as I want. How can the properties of these log messages be configured?

I have tried my own properties file with


> -J-Djava.util.logging.config.file=logging.properties


but this stops the application console messages, and writes just to my new file location, and the IDE console.

Also how do I get the settings migrated within the install build so that log messages are enabled for the deployed application?

Regards,
Rupert




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to set application logging properties

Peter Hansson-2
I'll answer the latter part of your question which is about how
to get the app.conf customizations you do to be part of the deployed
application.

In the following I'll assume you are using Maven, not Ant.

1. In you "app" project, create a file called 'app.conf' and place it
in 'src/main/etc/'. This is your customized config file.

2. In your POM for the 'app' project :
 <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>nbm-maven-plugin</artifactId>
                <configuration>
                    <etcConfFile>${basedir}/src/main/etc/app.conf</etcConfFile>
                    ....
                </configuration>


config parameter.

You can name the conf file anything you want and place it anywhere you like.
It doesn't matter what you name it. In your actual distribution it will be
be named by your app's name.

Example: My app's name is 'butterfly'.  Regardless of the fact that I use
a generic name such as 'app.conf' in my build, the resulting file in the
distribution will be 'butterfly.conf".  (the Maven plugin will do all the renaming).


/Peter



On Thu, Jul 6, 2017 at 11:44 AM, ruperty <[hidden email]> wrote:
In development (for a NPA) to get the java logging to appear in the Application Log I set jvm args with


> -J-Dnetbeans.logger.console=true -J-ea


This also displays in the IDE console and writes log messages to a file at build\testuserdir\var\log\messages.log. (What is -J-ea?)

But the format and filtering is not as I want. How can the properties of these log messages be configured?

I have tried my own properties file with


> -J-Djava.util.logging.config.file=logging.properties


but this stops the application console messages, and writes just to my new file location, and the IDE console.

Also how do I get the settings migrated within the install build so that log messages are enabled for the deployed application?

Regards,
Rupert





Loading...