Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Logging on Server ???

 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Should I log Exceptions on the server or it is Ok to log them only on the client?

Tx,
Vlad
 
Tony Collins
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to log them on the server and not the client. As the client may be remote.
Tony
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tony,
I guess you had also adapter.
So, there three opportunities to do it:
1. in the Data class
2. in the Adapter class
3. in the RemoteAdapter class
I log all exceptions on the GUI client.
So, probably it would then make sense to log them also only in Remoteadapter class.
So, in a local mode: The GUI client will get all exceptions logged.
In remote mode then the client and remote server will get all exceptions logged, but I would have to catch them separately in remoteADapter just log them.
I wanted to log exception on the client so, that it has trace of bad thing happened, excepecially in remote mode.
But now I don'�t know here should I log exception on the server (Adapter or Data class). I think Data, but that would mean that in local mode the client will be twice notified.
Vlad
 
Tony Collins
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I logged exceptions in both the adapter and the data class. This was so I could see how an exception was promoted. For example in the adapter if I caught a recordNotFoundException after I had locked a record, I chained that exception in a FatalErrorException and logged the error. So the recordNotFoundException was logged in Data and the FatalErrorException was logged in DBAdapter. So basically I logged an Exception when I created an exception.
BTW Vlad, it took 3 days for my project to be marked so if you submit this week you may get the result by next week.
Tony
[ October 02, 2003: Message edited by: Tony Collins ]
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is what I have decided to do.
On the client I call logger.severe() and on the server I will just do logger.throwing() where it is thrown. I think it should be acceptable.
Tony, I am done with implementation. The only thing, which doesn't let me sleep is my RecordModel.
My AdapterInterface(Server) has for example following signatures:
RecordModel read (int recNo);
RecordModel[] find (Hashtable criteria);
void update (RecordModel record);
...
My TableModel in GUI holds data as RecordModel[].
Theoretically, I could be blamed that I didn't strictly separated View from Controlller (Let's client from server), because my GUI uses the Class from server. I could of course make additional class on GUI Client: GUIRecordModel, but I don't like to make two actually the same classes.
Could you just shorty describe the idea you have done it?
Best,
Vlad
 
Tony Collins
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I extended AbstractTableModel and added the functions
public void addRecord(long recNo, String[] rec)
public long getRecordNum(int index)
When adding a record I stored my record as a String[] against a record No in a table element object( private class ) and added it to an arrayList. My getRecordNum could then get the record number of a particular element in the list. getValueAt would return the String[]. I also added a function to set column headers.
Tony
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tony,
You answered very fast. Tx! Are you permanent on-line!
May I ask you then one more question:
Does your book method in adapter has also String[] or a separate class:
void book(int recNo, String[])...;
String[] find (String[] criteria...);
Schema getSchema();
or
void book(Record record)...;
Record[] find (String[] criteria...);
Schema getSchema();
Tx,
Vlad
 
Tony Collins
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My book record is
public void bookRecord(long recNo, String csr)
throws DBFatalErrorException, RecordNotAvailableException
You only need the record number and the value of the field that needs updating.
I've been online quite a bit lately.
Tony
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tony,
and what about your find method ?
is it String[] find (...)?
If it is String[] and not Record[] I will eat my shoe!!! I have invested
so much time to do RecordModel[] thinking I would be penaltied for using String[]!

Best,
Vlad
[ October 02, 2003: Message edited by: Vlad Rabkin ]
 
Tony Collins
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
get that shoe off Vlad, it is String[].

Tony
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tony,
Well, be sure I will not sleep this night!

Tx a lot!

P.S. My biggest mistake was that I was trying to gather what Sun wants by analyzing different designs and lost scores for them. A lot of people have String[] methods and getSchema, but they lost aound 15 point. Now, I understand that the problem was probably something else (e.g. bad MVC). Oeah....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic