Editing a log or exe file in java

Hi,

I have a log file called recording.log. This is a file which has the results of communication between

server and number of clients. The extension of the file is .log The content is in machine language(or even I am not sure abt the format). its a log file which has strange, special characters which I cannot copy paste in an editor. Its similar to opening a .exe filein any editor

my task is to convert this into some readable form. to binary or UTF or i am not sure yet.

what format is the log file? or how can i convert this into another format?

any help will be great.

bye,

with regards,

Deepak.

[657 byte] By [angeshwar] at [2007-9-30 18:55:03]
# 1
The fact that it's called .log doesn't say anything about how to read the contents, I'm afraid. You need to look up the documentation for whatever program created the log file to know what's in there.
Herko_ter_Horst at 2007-7-6 21:13:32 > top of Java-index,Administration Tools,Sun Connection...
# 2

Hi,

The code to record the parameters into the log file is already there.

You simply run the code and the number of users can be set and

the arguments passed by each user accessing the server can also be set.

After the server is accessed by n number of users, the log file is generated.

The parameters (to be) present in the log file are

1)the recording time of the user accessing the server

2)the URL

3)a method invocation i.e. a simple function through which a

value or a dummy html page was sent to the server from the client.

these 3 values are recorded in the log file.

my task will be to extract these results from the log file

and feed the values to a tool like Jmeter and get some

graphical output and find ways and means to improve the

client-server access/response time.

This will be my task.

In the log file, I inserted the character 'a' in between the special characters,

opened the file and displayed the bytes thro

........

........

try

{

RandomAccessFile raf = new RandomAccessFile ("C:/practice/recording.log", "rw");

raf.seek (0);

for(i=0; i<=raf.length(); i++)

{

System.out.println(raf.readByte () );

}

......

......

and i got the following

97

-84

97

-19

97

0

97

5

97

119

97

122

97

0

97

0

97

0

97

-1

97

83

97

67

97

102

97

-21

97

0

97

112

97

I get the appropriate Dec value for 'a' and for the rest of the special characters.

I checked the

http://www.asciitable.com/

but could not find more, or I am not sure if I am doing the right thing.

bye,

with regards,

Deepak.

angeshwar at 2007-7-6 21:13:32 > top of Java-index,Administration Tools,Sun Connection...
# 3
What you need to do is find out how the information is written into the log file. Looking at bytes isn't gonna help you. Is there no documentation available on how the log is encoded?
Herko_ter_Horst at 2007-7-6 21:13:32 > top of Java-index,Administration Tools,Sun Connection...
# 4

Hi,

I have a binary file, whose content is like this

 wt>/ jhttp://c96100005795.str.daimlerchrysler.com/clientcontainer/rpc/clientcontainer/ejb/UserInformationServicesr (dcx.integration.service.MethodInvocation齖{齮 [

argumentTypest [Ljava/lang/Class;[ argumentValuest [Ljava/lang/Object;L declaringClasst Ljava/lang/Class;L

methodNamet Ljava/lang/String;xpur [Ljava.lang.Class;?Z? xppvr @dcx.appclient.container.userinformation.APPUserInformationRemotexpt getUserInformationwt[?jhttp://c96100005795.str.daimlerchrysler.com/clientcontainer/rpc/clientcontainer/ejb/UserInformationServicesq ~ uq ~ pvr javax.ejb.EJBObjectxpt removewn\?dhttp://c96100005795.str.daimlerchrysler.com/clientcontainer/rpc/clientcontainer/ejb/ContainerServicesq ~ uq ~ vr java.lang.String?z;鼴 xpq ~ q ~ ur [Ljava.lang.Object;X?s)l xpt j2eecct11pt vr 9dcx.appclient.container.service.APPContainerServiceRemote

i.e. I have some binary data and some useful URL link embedded in it. My task is to extract the URl part alone and write that in another file. So how can I sepertate the binary content from the remaining part.

Any help will be great.

bye,

with regards,

Deepak.

angeshwar at 2007-7-6 21:13:32 > top of Java-index,Administration Tools,Sun Connection...
# 5

> So how can I sepertate the binary content from the remaining part.

A sidenote: Unix comes with the sommand "strings", which does exactly this.

For example:

$ type sed

sed is /usr/bin/sed

$ type sed

sed is /usr/bin/sed

$ file /usr/bin/sed

/usr/bin/sed: symbolic link to `/bin/sed'

$ file /bin/sed

/bin/sed: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), stripped

$ strings /bin/sed|head -10

/lib/ld-linux.so.2

SuSE

libc.so.6

strcpy

mkstemp64

regexec

stdout

ungetc

strerror

fdopen

BIJ001 at 2007-7-6 21:13:32 > top of Java-index,Administration Tools,Sun Connection...
# 6

Thanks,

but is there any way in java to seperate the content. by th by, the extracted binary data is to be put in a seperate file and sent to the server along with the URL part. All these data will be send to the Jmeter tool for testing tje load on the web server.

the binary data are java serialised objects, so its format 'has' to be binary. is there any way to seperate the content.

bye,

with regards,

Deepak.

angeshwar at 2007-7-6 21:13:32 > top of Java-index,Administration Tools,Sun Connection...