Re: How to set application logging properties

Peter Hansson <[email protected]> Tue, 11 Jul 2017 09:56:41 +0200
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Message-ID <CAC55jYPVUQXJjHWcq563jWjW3f4YNJM2UF-reiHKx0zL3tR3tA@mail.gmail.com>
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>


Bottom line: The whole trick is in utilizing the
http://www.mojohaus.org/nbm-maven-plugin/cluster-app-mojo.html#etcConfFile
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 <[email protected]> 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
>
>
>
>
>