Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Changing a log file's attributes such as the owner property

Reply
Thread Tools

Changing a log file's attributes such as the owner property

 
 
marcwentink@hotmail.com
Guest
Posts: n/a
 
      04-06-2006
I have been looking how to change the file attributes inside java, I
want to make a java program that would give certain Linux rights to the
created file. But it seems this is impossible, which is logical if you
take into account that java should be platform independant, and
ownership is typical a unix/linux property.

Right?

Nevertheless, if I try to make a log file it is only readable for the
linux user that started the java application. And this not always the
user that will try to read the log file. So what could I do?

Marcus Wentink

 
Reply With Quote
 
 
 
 
marcwentink@hotmail.com
Guest
Posts: n/a
 
      04-06-2006
Gordon Beaton:

> Or use Runtime.exec() after creating the > file to invoke a linux


Ok, that's a good idea. Thank you very much

And if I use it like +/- this code below 'chmod' will only be used once
every java VM machine call.

class LogIt
{
private static File file;
private static BufferedWriter out;

static
{
open();
Runtime.exec()
}




Marcus Wentink

 
Reply With Quote
 
 
 
 
Gordon Beaton
Guest
Posts: n/a
 
      04-06-2006
On 6 Apr 2006 06:19:59 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Nevertheless, if I try to make a log file it is only readable for the
> linux user that started the java application. And this not always the
> user that will try to read the log file. So what could I do?


The default file creation mode is determined by the user's umask. If
you want to change the default file permissions, change the umask in
the user's shell before running the application. "man umask" will tell
you more.

Or use Runtime.exec() after creating the file to invoke a linux
specific utility (chmod) to let other users read the file.

If the file is (already) readable by members of the file's *group*,
you might also add (specific) users to that group so they can read the
file.

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
property owner info antradman Computer Information 2 04-08-2008 04:59 PM
how can i log on as owner instead of admin Jimmy Computer Support 2 11-26-2006 04:39 PM
Custom Attributes (AttributeTargets.Property) and Property Type Zarko Gajic ASP .Net Building Controls 0 04-07-2005 02:20 PM
Changing program owner's name? Kenny Cargill Computer Support 3 02-02-2004 03:32 AM



Advertisments