New Ranks & Badges For The Community!
Notice something different? The ranks and associated badges have gone "Star Fleet". See what they all mean HERE
Highlighted
Absent Member.
Absent Member.
1865 views

Server Admin log

Jump to solution

Hi Anil,

I'm trying to output the Server Admin log to a .txt file, but I get an error saying:

The method writeLogFile(File, ServerAdministration.ServerLogType, ServerAdministration.ServerLogMode[]) in the type ServerAdministration is not applicable for the arguments (File, ServerAdministration.ServerLogType, ServerAdministration.ServerLogMode)

Any ideas?  Also is there a way I can have the Server log keep running on an open .txt file without refreshing?

Thanks for all your help!

Ed

0 Likes
1 Solution

Accepted Solutions
Highlighted
Fleet Admiral
Fleet Admiral

i do also want to point out that this SDK approach writes the 'raw' log content out to the file.

this is no different than copying the log file from the server configuration folder, and is of little to no value if you intend to decipher/parse it's content.

for this latter case, the command line connections-log command is the preferable approach.

take care

anil

View solution in original post

0 Likes
4 Replies
Highlighted
Fleet Admiral
Fleet Admiral

Hi Ed,

The third argument is an array of ServerLogMode entries, not a single one...

here's an example...

Server s = ...;

ServerAdministration sa = s.getAdministration();

java.io.File f = java.io.File.createTempFile("foo", ".log");

sa.writeLogFile(f,

com.starteam.ServerAdministration.ServerLogType.LOG_TYPE_PURGE,

com.starteam.ServerAdministration.ServerLogMode.ALL);

>> is there a way I can have the Server log keep running on an open .txt file without refreshing?

i'm not sure i understand what you are trying to do, but the call to sa.writeLogFIle

internally has to make a very expensive call from the SDK to the StarTeam server to fetch the entire log content.

each call to writeLogFile would fetch all that data once again.

There's no way to fetch it partially, so i guess there's no way to keep it 'running' on an open file.

hope this helps

have a good weekend!

anil

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi Anil,

Great, that took care of the error, however the file didn't get outputted. Here's what I did:

Path pth = Paths.get(System.getProperty("usr.home"), "loggies", "log.txt");

File fi = pth.toFile();

sa.writeLogFile(fi, com.starteam.ServerAdministration.ServerLogType.LOG_TYPE_SERVER, com.starteam.ServerAdministration.ServerLogMode.ALL);

Can you spot what the problem is?

Thanks and have a nice weekend yourself!

Ed

0 Likes
Highlighted
Fleet Admiral
Fleet Admiral

hi ed,

i'm sorry, i cannot.

as i did point out however, my little example works correctly, and the file is produced

              Server s = new Server(...);;

              s.logon(...);

ServerAdministration sa = s.getAdministration();

java.io.File f = java.io.File.createTempFile("foo", ".log");

sa.writeLogFile(f,

com.starteam.ServerAdministration.ServerLogType.LOG_TYPE_SERVER,

com.starteam.ServerAdministration.ServerLogMode.ALL);

System.out.println(f.length());

my best guess is that there is some problem with the usage of Path & path.toFile().

take care

anil

0 Likes
Highlighted
Fleet Admiral
Fleet Admiral

i do also want to point out that this SDK approach writes the 'raw' log content out to the file.

this is no different than copying the log file from the server configuration folder, and is of little to no value if you intend to decipher/parse it's content.

for this latter case, the command line connections-log command is the preferable approach.

take care

anil

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.