getting the log path on the client

For questions and postings not covered by the other forums
User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

getting the log path on the client

Postby ghosttie » Wed Nov 24, 2010 10:06 am

I want to log some information to the client's log directory. Is this the right way to do it?

Code: Select all

getLogPathClient() : String; vars sLogPath : String; begin sLogPath := getProfileString(getIniFileName, "JadeLog", "LogDirectory", "<default>"); if sLogPath.toLower = "<default>" then sLogPath := process.getJadeHomeDirectory.ensureTrailingSlash & "logs\"; elseif sLogPath[1:2] <> "\\" and sLogPath[2:1] <> ":" then // relative path sLogPath := process.getJadeHomeDirectory.ensureTrailingSlash & sLogPath; endif; return sLogPath.ensureTrailingSlash; end;
ensureTrailingSlash is a method on String that just appends a slash if there isn't one there already.
I have a catapult. Give me all the money or I will fling an enormous rock at your head.

User avatar
BeeJay
Posts: 312
Joined: Tue Jun 30, 2009 2:42 pm
Location: Christchurch, NZ

Re: getting the log path on the client

Postby BeeJay » Wed Nov 24, 2010 10:17 am

From a quick scan of the code it looks like a reasonable start.

You'd probably want to add clientExecution to the method signature though, in case you're ever calling this from a serverExecution method. ;)

Cheers,
BeeJay.

User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

Re: getting the log path on the client

Postby ghosttie » Wed Nov 24, 2010 10:21 am

Thanks. I wasn't clear on what base path a relative path should be appended to - getJadeHomeDirectory or getUserDataDirectory - and whether it should be the one from the process or node...
I have a catapult. Give me all the money or I will fling an enormous rock at your head.

User avatar
BeeJay
Posts: 312
Joined: Tue Jun 30, 2009 2:42 pm
Location: Christchurch, NZ

Re: getting the log path on the client

Postby BeeJay » Wed Nov 24, 2010 10:32 am

Ah, you're referring to a thin client, rather than a standard client - I should have deduced that with your sample code having Process::getJadeHomeDirectory not Node::getJadeHomeDirectory. I was going to add that you could use the JadeLog::infoClient etc methods and let JADE take care of working out the "logs" directory for you when you're running a standard client.

Note: It would be nice if NFS 33128 was implemented. Then you'd be able to avoid all this complexity by using the JadeLog class with JadeLog::infoThinClient etc methods and let Jade take care of working out the "logs" directory on the thin client for you.

Cheers,
BeeJay.

User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

Re: getting the log path on the client

Postby ghosttie » Wed Nov 24, 2010 11:32 am

So do you think it's correct to use the Home Directory instead of the User Directory on a thin client?
I have a catapult. Give me all the money or I will fling an enormous rock at your head.

User avatar
BeeJay
Posts: 312
Joined: Tue Jun 30, 2009 2:42 pm
Location: Christchurch, NZ

Re: getting the log path on the client

Postby BeeJay » Wed Nov 24, 2010 2:19 pm

It all depends on where your thin client is installed to and what you are wanting to achieve.

If your thin client is installed into the Windows "Program Files" folder, and you want each user to have their own copy of the "logfile" then you would use getUserDataDirectory.

If your thin client is installed into the Windows "Program Files" folder, and you want all users to share one copy of the "logfile" then you would use getProgramDataDirectory.

If your thin client is not installed into the Windows "Program Files" folder, then it probably doesn't matter which of these you use as it would appear that they both default back to JADE HOME directory anyway, at least that's what the JADE doco says.

Note: I haven't tested any of this out programmatically, I'm just going by what the JADE documentation has to say in this regard. ;)

Cheers,
BeeJay.

User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

Re: getting the log path on the client

Postby ghosttie » Thu Nov 25, 2010 2:23 am

OK, it sounds like getUserDataDirectory is the right choice because it returns the same as getJadeHomeDirectory unless JADE is installed in program files, in which case it returns the user data directory. This is what we want because we don't want to try to log to program files because we won't have permission as of Vista.

node.getUserDataDirectory seems to return a path on the server and process.getUserDataDirectory returns a path on the client.
I have a catapult. Give me all the money or I will fling an enormous rock at your head.


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 12 guests