Menu

Howto use own properties file

Help
2008-08-21
2013-04-26
  • Jimisola Laursen

    Hi!

    I'm trying to setup use my own properties file (placed under /res/microlog.properties in EclipsME to be automatically placed in the root of the jar during packaging). But, after packaging by EclipseME the default microlog.properties from MicroLogV0.5.0.2.jar/META-INF/ lies in the root of my midlet jar file.

    Am I suppose to use PropertyFile myself or how?

    A short example would be very useful. I currently use:

    TeslanTester.log = Logger.getLogger();
    final Properties properties = new Properties(this);
    TeslanTester.log.configure(properties);

    Also, information on how to change the RecordStore name would be neat. A nice solution would be to default to the name of the midlet.

    Regards,
    Jimisola

     
    • Nobody/Anonymous

      Hi,

      we currently have an issue that the example properties is packaged with the jar file. The result is that the user defined microlog.properties file is overwritten when packaging. The workaround could be to open the MicroLog0.5.0.2.jar file in winzip and delete the microlog.properties file.

      If you would like to set the recordstore name in the microlog.properties file you use the following property:
      microlog.appender.RecordStoreAppender.recordStoreName

      I have also added propert methods to set the recordstore name. This will be included in the next release.

      It is a nice suggestion that the recordstore name is the name of the MIDlet.

      Regards
      Johan
      // MicroLog admin

       
    • Nobody/Anonymous

      Now if we ignore this bug for a moment:

      ..will the next release have an API that allows to load properties from a file other than 'microlog.properties' and to use these properties for configure() ? It would be great to be able to have different files that get loaded depending on the context (development, deployed to 'production').

      Cheers,
      Diego

       
    • Johan Karlsson

      Johan Karlsson - 2008-08-31

      Hi,

      I am currently working on this. This will be checked in during the day.

      BTW the bug is removed. The default name for the recordstore is now the name of the MIDlet ("MIDlet-Name").

      Best Regards
      Johan

       
      • Jimisola Laursen

        Johan,

        Perhaps it would be better for the RecordStore to be named after the Midlet-Name with an additional suffix or prefix (e.g. "MyMidlet-Log" or "MyMidlet-ml"). This to limit the risk of using a RecordStore name that the midlet is already using.

        Regards,
        Jimisola

         
    • Nobody/Anonymous

      Excellent, great work ! Thanks :-)

      Diego

       
    • Johan Karlsson

      Johan Karlsson - 2008-08-31

      Hi,

      I will implement this as soon as possible.

      Best Regards
      Johan
      // MicroLog admin

       
    • Johan Karlsson

      Johan Karlsson - 2008-09-01

      Hi,

      the new code is checked in. I have decided to use "-ml" as the suffix. Since the limit of the recordstore name is 32 characters, the midlet name must not be longer than 29 characters. If the name is longer, the default name is used instead.

      Best Regards
      Johan
      // admin

       

Log in to post a comment.