Peter wrote:
> The android.util.log class appears to be geared solely towards
> debugging on an emulator.  Am I wrong? 

I can't speak to "solely", but, certainly, that's its primary use.

> Is it possible to specify that
> this log is written to a file and then access it externally, copy it,
> or even e-mail it?

I'm not aware of ways to do that on the device itself. With the SDK,
you'll have tools to dump the log to files on the host computer.

> Alternatively, if I am to write my own log file, or have an
> application configuration file, what would be the best place to put
> it? 

Context#getFilesDir() will give you the private storage directory for
your application (/data/data/your.package.here/files). Since Activity
and Service and ContentProvider all inherit from Context, you should
have access to this method from most places where you'd need it.

However, with on-device storage sometimes being low, if you intend for
your log file to grow unbounded, you may wish to consider writing it to
the SD card.

Also also, please consider using the SharedPreferences system for
application configuration data (at least the user-modifiable bits), so
you can use the PreferenceScreen system to give users a consistent UI
for adjusting those preferences. SharedPreferences will manage the
storage for you.

> Where
> exactly will android.os.Environment.getDataDirectory() point to?  Is
> this specific to my application, or all applications? 

I have no idea. You're probably better served using Context#getFilesDir().

> Is it the most
> appropriate place to put publicly accessible log files?

Define "publicly accessible".

If your goal is to allow "the end user to be able to examine the
application log file, and also to be able to send it to us if there are
issues", you may want to build all that functionality into your
application. Then, public versus private is immaterial.

If that is unacceptable, and you need other programs to work with your
log file, your best answer is to put it on the SD card, assuming it's
available.

> Or should I
> simply try to create my own directory at the root?

Root of...the device? You can't on devices, for security reasons.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 2.0 Available!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to