The problem is with the path you suppled. By saying "droid.log", it
will try to write to /droid.log , which you don't have write access
to. Android applications on have write access to their subdirectory of
the file system, generally speaking. Your code should look like this:

            handler = new FileHandler(getFilesDir().getAbsolutePath()
+ "droid.log", 1000, 2);

Cheers,
Justin
Android Team @ Google

On Aug 27, 4:32 am, rajesh <[EMAIL PROTECTED]> wrote:
> I am trying to log data to my file.
>
> try {
>                  handler = newFileHandler("droid.log", 1000, 2);
>                  logger.addHandler(handler);
>                 } catch (IOException e) {
>                         // TODO Auto-generated catch block
>                         e.printStackTrace();
>                 }
>                 LogRecord record = new LogRecord(Level.INFO, "Logged in a 
> file..
> 22.");
>                 logger.log(record);
>
> I used the above code,
> but I always get fileNotFound exception on android.
>
> How do I log to a file (trying out rolling file appender)
>
> One way to log to a file is write to file, which I am able to do it.
> But I want to use logger api to do the same.
>
> Please help
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to