Re: would you please help
2009-09-01 00:26:59 GMT
I thank your answer and help but your message is absolutely out of place (desubicado) and not polite.
Why did you assume I did not try to google the problem or other ways to learn about my questions?
In one hand "java logging" is not the obvious way to search a Netbeans feature , why not "java logger" that give no answers except the propertiers catalog I mentioned?
Moreover if you yourself say you think there is no answer for my first question, how would I have googled it?
I thanked in advance and asked properly, where does your agression find a basis?. You should better limit your messages to the matters posted and reserve the manner analysis for, and about, yourself. I hope you are not one of those chauvinist that attacked me in the past for not using pure us-english.
By the way, as your e-mail says you are from SUN I shall use this opportunity to suggest to who corresponds in SUN through you to abandon such old-fashioned non international ways of doing things. The second majority in USA speaks my language so you can not ban spanish even from an USA point of view.
Getting to the matter:
If you are running from the IDE the system.out messages may be enough for work or debug , but if you are out from it you must know it and post messages in a differing way. This is linked to the 2nd question since I want to substitute the "logger - Netbeans - aggregate" in catch clauses for a unique function working differently out or in the IDE.
I do not know how you do not notice that sentence in catch clauses, Netbeans writes it whenever you admit it to write a try-catch clause; always the same one whatever the kind of exception.
The article you referenced is better than Sun properties documentation (I did not refer to Javadocs) but it lacks the main ideas: "why" and "what for" and unfortunately has no examples as far as I have read, so it remains in an abstract level.
I assume your good will and thank you for your help once more
Best regards
Pablo
Vojtech Sigler escribió:
Hi Pablo,
if you want your questions answered, you should learn how to ask and also some manners.
Here are some tips:
1) spend at least 5 minutes googling first ;)
2) describe the problem you're facing, maybe, there's an alternative solution you did not see at first, but someone else did
3) saying things like "javadoc is useless" (at least that's what I understood by "not that list of class properties that SUN is so fond of and gives nothing") will get you nowhere and you'll end up being ignored
4) try be polite ;)
Ok, to your questions:
1) I am not aware of any means of telling where is your app run from. As far as I know there is no difference in running the app from the IDE and from the command line. If you're having trouble that the 'dist' dir is erased, you can use a different workdir for your app. Just invoke project properties -> Run and set your desired path in "Working directory" text field.
2) Well if you consider javadoc useless, you could try googling for e.g. "java logging". You'll get a dozen articles about logging in java.
Anyway, the line you asked about is simple:
Logger.getLogger() - this static method will get you a logger instance for your class, usually you'll have just one logger for a class. As for the argument, you can call getLogger(mypackage.X.class.getName()) or getLogger(mypackage.X.class) or getLogger("mypackage.X"), the result is the same. The argument is just the name of the logger. You could even invoke getLogger("myCoolSuperLogger").
log(Level.SEVERE, null, ex) - this piece of code logs an exception that occured, with logging level SEVERE, which says your application is in serious trouble ;) you can have other levels such as WARNING or INFO. The null is for a String value, usually you want a message to go into the log like log(Level.SEVERE, "I'm done for, just use kill -9 already :(", ex) or log(Level.INFO, "All is OK", null). Ex is an exception you can attach to the log (it will get printed into the log output).
So, the line you asked about is just a default handling of an exception. Though I'm not sure where did you get it or where Netbeans generate such code.
Ask google for more info ;) The first result in google is this: http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/overview.html which is rather old, but it will give you some idea.
I hope this was useful :)
Vojta
PEB wrote:I posted the questions bellow 3 days ago. I did not get a single response, are them so difficult to answer?
thanks
Hi,
1)I want to know if there is a way by which an application can determine if it is running *from the IDE* or *by its own *
2) Can you guide me to a good article (not that list of class properties that SUN is so fond of and gives nothing) where I can learn what are things like this *Logger.getLogger(X.class.getName()).log(Level.SEVERE, null, ex)*
that Netbeans wrote whenever it draws a Try in class X for someexception ex,
intended for ?
Say, what juice can you take from it, why is it always Level.SEVERE etc...?
thank you for your help
Pablo
------------------------------------------------------------------------
No virus found in this outgoing message.
Checked by AVG - www.avg.com
Version: 8.5.409 / Virus Database: 270.13.72/2337 - Release Date: 08/31/09 05:50:00
No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.409 / Virus Database: 270.13.72/2337 - Release Date: 08/31/09 05:50:00
No virus found in this outgoing message. Checked by AVG - www.avg.com Version: 8.5.409 / Virus Database: 270.13.72/2337 - Release Date: 08/31/09 05:50:00
In NB 6.5 it was possible with New File->Other->Empty File.
>> And Second some of my plain text files in older projects i can't see
>> under "Files" tab which was possible in NB 6.5. The files are exists.
>> Are there any reasons for this behaviour?
>>
>> Matthias
>
--
---------------------------------------------------------
Stadt Mansfeld
Lutherstraße 9
06343 Mansfeld
Öffnungszeiten:
Dienstag 9 - 12 Uhr 13 - 18 Uhr
Donnerstag 9 - 12 Uhr 13 - 15 Uhr
Freitag 9 - 12 Uhr
Telefon: +49 34782 8710
Fax: +49 34782 87122
E-Mail: m.scholz <at> mansfeld.eu
WorldWideWeb:
RSS Feed