[Geoserver-devel] LOGGING in geoserver 2.0 WICKET UI

HI all,

i try print message log in the geoserver 2.0 web-security module but not working.

I have the class:


static final Logger LOGGER = Logging.getLogger(DAOConfigurationProperties.class);

public ConfigureChainOfResponsibility loadConfiguration()
throws DAOException {
ConfigureChainOfResponsibility chain = null;
try {
File security = GeoserverDataDirectory.findConfigDir(
GeoserverDataDirectory.getGeoserverDataDirectory(),
“security”);
Properties properties = loadProperties(security.getAbsolutePath()

  • “/” + “layers.properties”);

LOGGER.log(Level.INFO, “SCANNING MAP FILE”);
for(Map.Entry entry : properties.entrySet()){
final String ruleKey = (String) entry.getKey();
final String ruleValue = (String) entry.getValue();
final String rule = ruleKey + “=” + ruleValue;
LOGGER.log(Level.INFO, “RULE”+rule);
}

and load this in the wicket page class:

public class SecurityPage extends ServerAdminPage {

private TreeTable tree;

private Catalog catalog;

public SecurityPage() {

IModel resourceListModel = new LoadableDetachableModel() {
public Object load() {

IDAOConfiguration dao = new DAOConfigurationProperties();

try {
ConfigureChainOfResponsibility configuration = dao.loadConfiguration();
configuration.run(ConfigurationSingleton.getInstance());
} catch (DAOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

but in the console message not have any message.

Suggestion?

Thanks,


Francesco Izzi
CNR - IMAA
geoSDI - NSDI
Responsabile Sviluppo Software

C.da Loja
85050 Tito Scalo - POTENZA (PZ)
Italia

phone: +39 0971427305
fax: +39 0971 427271
mob: +39 3402640314
mail: francesco.izzi@anonymised.com
skype: neofx8080

web: http://geosdi.nsdi.it

Francesco Izzi ha scritto:

HI all,

i try print message log in the geoserver 2.0 web-security module but not working.

I have the class:

...
static final Logger LOGGER = Logging.getLogger(DAOConfigurationProperties.class);

    public ConfigureChainOfResponsibility loadConfiguration()
            throws DAOException {
        ConfigureChainOfResponsibility chain = null;
        try {
            File security = GeoserverDataDirectory.findConfigDir(
                    GeoserverDataDirectory.getGeoserverDataDirectory(),
                    "security");
            Properties properties = loadProperties(security.getAbsolutePath()
                    + "/" + "layers.properties");
                       LOGGER.log(Level.INFO, "SCANNING MAP FILE");
            for(Map.Entry entry : properties.entrySet()){
                final String ruleKey = (String) entry.getKey();
                final String ruleValue = (String) entry.getValue();
                final String rule = ruleKey + "=" + ruleValue;
                LOGGER.log(Level.INFO, "RULE"+rule);
            }
...

and load this in the wicket page class:

public class SecurityPage extends ServerAdminPage {

    private TreeTable tree;

    private Catalog catalog;

    public SecurityPage() {
    ...
       IModel resourceListModel = new LoadableDetachableModel() {
            public Object load() {
                               IDAOConfiguration dao = new DAOConfigurationProperties();
                               try {
                    ConfigureChainOfResponsibility configuration = dao.loadConfiguration();
                    configuration.run(ConfigurationSingleton.getInstance());
                } catch (DAOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
    ...

but in the console message not have any message.

Suggestion?

Hum, logging is controlled by a couple of classes which are LoggingInitializer, that changes the logging level as we
hit "apply" on the UI (generally speaking, when the logging
configuration is changed) and LoggingStartupContextListener that
sets up the necessary overrides before anything can start to
log (well, not exactly anything, but it's run pretty close
to the beginning of the GeoServer startup operations).

The logging initializer is declared in the main module
Spring context, so it should be around not matter what
UI you use (old or new). The context listener has to be
registered in the web.xml instead.

As far as I can see both are registered properly...
In fact I added the following code to the home page:

private static final Logger LOGGER = Logging.getLogger(GeoServerHomePage.class);

     public GeoServerHomePage() {
         LOGGER.info("Entering the home page");

and the message appeared in the logs:

09 gen 11:19:09 INFO [geoserver.we] - Entering the home page

Then to double check I did the same on the WFSAdminPage,
and again the logging appeared.
Also tried the same syntax as you( LOGGER.log(Level.INFO, "SCANNING MAP FILE"):wink: and it worked...

Soo... I don't know, here it works fine... :frowning:

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Hi Francesco,

I fired up your code and added some logging statements and they all showed up... so not sure what is going on? Can you verify that the code is actually executing by setting a breakpoint in the debugger?

Francesco Izzi wrote:

HI all,

i try print message log in the geoserver 2.0 web-security module but not working.

I have the class:

...
static final Logger LOGGER = Logging.getLogger(DAOConfigurationProperties.class);

    public ConfigureChainOfResponsibility loadConfiguration()
            throws DAOException {
        ConfigureChainOfResponsibility chain = null;
        try {
            File security = GeoserverDataDirectory.findConfigDir(
                    GeoserverDataDirectory.getGeoserverDataDirectory(),
                    "security");
            Properties properties = loadProperties(security.getAbsolutePath()
                    + "/" + "layers.properties");
                       LOGGER.log(Level.INFO, "SCANNING MAP FILE");
            for(Map.Entry entry : properties.entrySet()){
                final String ruleKey = (String) entry.getKey();
                final String ruleValue = (String) entry.getValue();
                final String rule = ruleKey + "=" + ruleValue;
                LOGGER.log(Level.INFO, "RULE"+rule);
            }
...

and load this in the wicket page class:

public class SecurityPage extends ServerAdminPage {

    private TreeTable tree;

    private Catalog catalog;

    public SecurityPage() {
    ...
       IModel resourceListModel = new LoadableDetachableModel() {
            public Object load() {
                               IDAOConfiguration dao = new DAOConfigurationProperties();
                               try {
                    ConfigureChainOfResponsibility configuration = dao.loadConfiguration();
                    configuration.run(ConfigurationSingleton.getInstance());
                } catch (DAOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
    ...

but in the console message not have any message.

Suggestion?

Thanks,

--
Francesco Izzi
CNR - IMAA
geoSDI - NSDI
Responsabile Sviluppo Software

C.da Loja
85050 Tito Scalo - POTENZA (PZ)
Italia

phone: +39 0971427305
fax: +39 0971 427271
mob: +39 3402640314
mail: francesco.izzi@anonymised.com <mailto:francesco.izzi@anonymised.com>
skype: neofx8080

web: http://geosdi.nsdi.it

------------------------------------------------------------------------

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB

------------------------------------------------------------------------

_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Hi Andrea, Justin
thanks for the replay.

I debug the code and i add the breakpoint, and the code is not execute. for this the logging not work :slight_smile:

This is strange because the

IModel resourceListModel = new LoadableDetachableModel() {
public Object load() {

IDAOConfiguration dao = new DAOConfigurationProperties();

try {
ConfigureChainOfResponsibility configuration = dao.loadConfiguration();
configuration.run(
ConfigurationSingleton.getInstance());
} catch (DAOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

the reason is maybe because the

ConfigureChainOfResponsibility configuration = dao.loadConfiguration();
configuration.run(ConfigurationSingleton.getInstance());

is in the LoadableDetachableModel ?

I move the code out the method and the loggin works fine.

2009/1/9 Justin Deoliveira <jdeolive@anonymised.com>

Hi Francesco,

I fired up your code and added some logging statements and they all showed up… so not sure what is going on? Can you verify that the code is actually executing by setting a breakpoint in the debugger?

Francesco Izzi wrote:

HI all,

i try print message log in the geoserver 2.0 web-security module but not working.

I have the class:


static final Logger LOGGER = Logging.getLogger(DAOConfigurationProperties.class);

public ConfigureChainOfResponsibility loadConfiguration()
throws DAOException {
ConfigureChainOfResponsibility chain = null;
try {
File security = GeoserverDataDirectory.findConfigDir(
GeoserverDataDirectory.getGeoserverDataDirectory(),
“security”);
Properties properties = loadProperties(security.getAbsolutePath()

  • “/” + “layers.properties”);
    LOGGER.log(Level.INFO, “SCANNING MAP FILE”);
    for(Map.Entry entry : properties.entrySet()){
    final String ruleKey = (String) entry.getKey();
    final String ruleValue = (String) entry.getValue();
    final String rule = ruleKey + “=” + ruleValue;
    LOGGER.log(Level.INFO, “RULE”+rule);
    }

and load this in the wicket page class:

public class SecurityPage extends ServerAdminPage {

private TreeTable tree;

private Catalog catalog;

public SecurityPage() {

IModel resourceListModel = new LoadableDetachableModel() {
public Object load() {
IDAOConfiguration dao = new DAOConfigurationProperties();
try {
ConfigureChainOfResponsibility configuration = dao.loadConfiguration();
configuration.run(ConfigurationSingleton.getInstance());
} catch (DAOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

but in the console message not have any message.

Suggestion?

Thanks,


Francesco Izzi
CNR - IMAA
geoSDI - NSDI
Responsabile Sviluppo Software

C.da Loja
85050 Tito Scalo - POTENZA (PZ)
Italia

phone: +39 0971427305
fax: +39 0971 427271
mob: +39 3402640314

mail: francesco.izzi@anonymised.com mailto:[francesco.izzi@anonymised.com](mailto:francesco.izzi@anonymised.com)

skype: neofx8080

web: http://geosdi.nsdi.it



Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB



Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.


Francesco Izzi
CNR - IMAA
geoSDI - NSDI
Responsabile Sviluppo Software

C.da Loja
85050 Tito Scalo - POTENZA (PZ)
Italia

phone: +39 0971427305
fax: +39 0971 427271
mob: +39 3402640314
mail: francesco.izzi@anonymised.com
skype: neofx8080

web: http://geosdi.nsdi.it