Java DNS logger

Hi,
I've written a small utility that in particular can help debugging DNS related problems with RMI applications.
It logs all DNS hostname and address resolutions and will show what hostnames were resolved and what hostnames couldn't be found.
This way one can see if the application attempts to connect to a host that is unavailable on its network.
It can be used with any java application (using a command line argument).
More details at http://www.genady.net/dns/ . Java 5.0+ required.
Comments are welcome,
Genady

Okay, I understand. However, I do not fully grasp why there's no such thing as a Java Domain Name Server. I mean, technically it's a server socket at port #57 answering to requests in a way defined by protocol (which should be in some RFC document).
Maybe I'm overlooking something, but to me it doesn't seem impossible or unwise to write a Java DNS server (shall we say: a "100% Pure Java DNS"). Or are there already numerous free DNS servers out there that I've apparently missed?

Similar Messages

  • Usage of java.util.Logger

    I have an API which has logs messages using java.util.Logger.
    While using this API to perform activities, i need those log messages to tell me when something is going wrong. How can I view those log messages in console?
    For eg: I have a class with following structure:-
    public class sample
    public static void main (String[] args)
    APIClass api = new APIClass();
    api.doStuff();
    Now i want the messages which are printed inside api to appear in my system console, but only SEVERE messages seems to come out, not INFO, FINE etc.
    Please let me how i can achieve this?

    I was able to get the messages out by following
    java.util.logging.Logger LOGGER = java.util.logging.Logger.getLogger("com.foo");
    java.util.logging.ConsoleHandler ch = new java.util.logging.ConsoleHandler();
    ch.setLevel(Level.FINE);
    LOGGER.addHandler(ch);
    LOGGER.setLevel(Level.FINE);

  • Java DNS Caching

    I have my Java DNS cache expiring every five minutes by setting it up in java.security. My question is - what happens when the DNS server is unreachable, ie. down ? Does Java retain what it already had in the event that it cannot reach a DNS server to update from, or does the domain that was being accessed become unavailable ?

    Thank you for your response. At least now I know it isn't something that I misconfigured. It is interesting that if I add this line to obj.conf, the statistics function appears to work, even though according to the admin interface DNS caching is disabled: (I got this from the help system.)
    Init cache-size="1024" expire="1200" fn="ip-dns-cache-init"
    The original entry put there by the admin interface is:
    Init cache-size="1024" expire="1200" negative-dns-cache="yes" fn="host-dns-cache-init"
    I do not have a Sun support contract. Is there a procedure to report this bug, or have you already done that?

  • Java.util.logger properties help

    Is there documentation somewhere describing what can be done with logging.properties? I can get the basics to work like setting the filehandler output name and setting level without any problem. However, what if I want 4 different output files for different packages within my application. Can I define 4 unique file handlers in the logger.properties and assign loggers or packages to my desired file handler/ output?
    Or does this have to be done in a java class such that I specify a logger class file at system instead of a logger config file. Of course, I'd prefer to use the config file if it has the capabilities needed. But, again, where are all the options documented?

    documentation for the set method
    * Sets the values for the calendar fields <code>YEAR</code>,
    * <code>MONTH</code>, and <code>DAY_OF_MONTH</code>.
    * Previous values of other calendar fields are retained. If this is not desired,
    * call {@link #clear()} first.
    * @param year the value used to set the <code>YEAR</code> calendar field.
    * @param month the value used to set the <code>MONTH</code> calendar field.
    * Month value is 0-based. e.g., 0 for January.
    * @param date the value used to set the <code>DAY_OF_MONTH</code> calendar field.
    * @see #set(int,int)
    * @see #set(int,int,int,int,int)
    * @see #set(int,int,int,int,int,int)
    *

  • Formatting Log message for Java.Util.Logger

    Hi,
    I want to format out put that i get when i logg the message
    example
    Sep 23, 2009 5:32:56 PM com.log.utils.helper info
    INFO: in Logging messagingI was wondering if I could get output like
    Sep 23, 2009 5:32:56 PM INFO: in Logging messagingThis is the code which i have used to generate logs
    public Logger logs() {
            makeLogFolder();
            Logger log = Logger.getLogger(UtilityHelper.class.getName());
            try {
                int limit = Integer.parseInt(loadProperties(
    Constants.PROPERTY_FILE_NAME)
    .getProperty(Constants.MAX_SIZE_OF_LOG_FILES));
                int numLogFiles = Integer.parseInt(getProperties(
    Constants.MAX_NO_OF_LOG_FILES));
                String LogFileName = getProperties(Constants.LOG_FOLDER) +
    File.separator + getLogInDate() + File.separator +
    getProperties(Constants.LOG_FILE) + getLogDate() +
    " " + getLogTime() + "_%g.log";
                FileHandler fh1 = new FileHandler(LogFileName, limit, numLogFiles);
                fh1.setFormatter(new SimpleFormatter());
                log.addHandler(fh1);
            } catch (IOException ex) {
                ex.printStackTrace();
            } catch (SecurityException ex) {
                ex.printStackTrace();
            return log;
    log.info(message);please let me know how can i do it
    thanks for the reply

    Note: This thread was originally posted in the [Java Virtual Machine (JVM)|http://forums.sun.com/forum.jspa?forumID=37] forum, but moved to this forum for closer topic alignment.

  • ESS WD Java travel logger

    Hi All,
    I have the following question; when i look at the WD Java code of esstratre i see that SAP made a java Class named LOGGER. I would like to know where i can find all the written txt writeen by the  LOGGER class and i hope somebody can tell what i need to configure.
    Thanks in advance.
    Kind regards,
    Maarten.

    Hello Raynard,
    When i look at the SAP Java code i regularly see this pieces of code:
    public void setTemplateSource( )
        //@@begin setTemplateSource()
              logger.pathT("Entering: setTemplateSource");
    What i would like to know is where i can find the information thiis "Logger" has written and if necesarry how to activate it.
    I hope you can help me.
    Thanks in advance.
    Kind regards,
    Maarten.

  • Java.util.Logger in ADF page

    The following code work fine in a standalone application and I can view the logs in my LogToFile2.txt
    public static void main(String args[]) throws IOException {
    Logger logger=Logger.getLogger("LogToFile");
    FileHandler logFile = new FileHandler("C:\\temp\\LogToFile2.txt",true);
    logFile.setFormatter(new SimpleFormatter());
    logger.addHandler(logFile);
    logger.info("[email protected]|PRP|listProject|21,Mar,2011:6:17");
    The same code I called from a managed bean it not logging anything just creates a LogToFile2.txt.lck file. Anybody know how to fix this ?
    Thanks
    Suneesh
    Edited by: Suneesh Raman on Mar 21, 2011 10:52 PM

    I want to log some details to a seperate log file. Idea to get the usage statistics. The access logs are not useful as its not changing the url for most of the cases. Is there any better way to get the usage statistics of each page ?
    Thanks
    Suneesh

  • Unable to capture messages from java.util.logging

    I have a class called (Caller.java) which invokes a method called foo from another java class(Util.java) using reflection API.Now this method foo logs messages using Java's logger.My requirement is to call foo for 3 times from Caller and capture/redirect the log messages into 3 log files.
    But only the first log file is capturing the log messages(from logger) and other two are not ?
    Plz suggest if I am doing somethin wrong here ?
    Caller.java
    package project2;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.PrintStream;
    import java.lang.reflect.Method;
    public class Caller {
        public Caller() {
        public static void main(String[] args) throws Exception {
            Caller caller = new Caller();
            for (int i = 0 ;i<3 ;i++ )  {
                caller.createLogStream(i);
                System.setOut(caller.getPs());
                System.setErr(caller.getPs());
                /*****************Invoking Util.java*****************************/
                Class clas = Class.forName("project2.Util");
                Method m = clas.getMethod("foo",null);
                Object obj =clas.newInstance();
                m.invoke(obj,null);
        public void createLogStream(int i) throws FileNotFoundException {
            ps = new PrintStream(new File(System.getenv("HOME")+File.separator+"MyLog"+i+".log"));
        public void closeLogStream(){
            ps.close();
            ps = null;
        private PrintStream ps = null;
        public PrintStream getPs() {
            return ps;
    } Util.java
    package project2;
    import java.util.logging.Logger;
    public class Util {
        Logger logger = null;
        public Util() {
            logger = Logger.getLogger(this.getClass().getName());
        public void foo(){
            System.out.println("Hello out stream");
            System.err.println("Hello error stream");
            logger.info("This is an information");
            logger.warning("This is a warning message");
            logger.severe("This is fatal!! ");
    }First Log file MyLog0.log:
    Hello out stream
    Hello error stream
    Feb 16, 2009 7:55:55 PM project2.Util foo
    INFO: This is an information
    Feb 16, 2009 7:55:55 PM project2.Util foo
    WARNING: This is a warning message
    Feb 16, 2009 7:55:55 PM project2.Util foo
    SEVERE: This is fatal!!
    Feb 16, 2009 7:55:55 PM project2.Util foo
    INFO: This is an information
    Feb 16, 2009 7:55:55 PM project2.Util foo
    WARNING: This is a warning message
    Feb 16, 2009 7:55:55 PM project2.Util foo
    SEVERE: This is fatal!!
    Feb 16, 2009 7:55:55 PM project2.Util foo
    INFO: This is an information
    Feb 16, 2009 7:55:55 PM project2.Util foo
    WARNING: This is a warning message
    Feb 16, 2009 7:55:55 PM project2.Util foo
    SEVERE: This is fatal!! Other 2 log files have only this much
    Hello out stream
    Hello error stream

    A stale Connection Factory or Connection Handle may be used in SOA 11g
    Regards,
    Anuj

  • Getting no output from java.util.logging.FileHandler

    I am new to Java as is the company I work for, but we have just landed a contract that specifies J2EE as the platform, so here we are. :-) Please bear with me.
    I have been charged with determining our logging architecture and it looks like what is available in java.util.logging will do well (though we may use log4j). However, at this point I am just trying to get anything to work and not having much luck.
    We are using JSF on the front end and I have created a very simple JSF page to test logging. The relevant code is below and I hope will be self explanatory: This code is not meant to be efficient or anything. It is just a proof of concept.
        public String button1_action() {
            // User event code here...
            try {
                Logger l = java.util.logging.Logger.getLogger(Page1.class.getName());
                l.entering(Page1.class.getName(), "button1_action");
                l.info(this.textField1.getValue().toString());
                l.exiting(Page1.class.getName(), "button1_action");
                java.util.logging.Handler h = l.getHandlers()[0];
                h.flush();
            catch(Exception ex) {
                //I have tested this and we aren?t catching any errors.
                System.err.println(ex);
            return "";
        }My logger.properties files looks like this:
    handlers= java.util.logging.FileHandler
    .level= FINEST
    java.util.logging.FileHandler.pattern = c:/sun/logs/test-%u.log
    java.util.logging.FileHandler.limit = 50000
    java.util.logging.FileHandler.count = 1
    java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatterI have developed and tested this in Sun Studio Creator 2004Q2 What is happening is that I am getting three log files in c:/sun/logs
    test-0.log, test-1.log and test-2.log. The first two contain output from various sun components. (sun.rmi.transport for example). The third log remains empty. (zero length)
    I have also deployed the test app to a tomcat 5.0.28 server and get similar results. The only difference is I get only one two log files and the second one remains empty.
    Any assistance or suggestions as to what direction I should be taking would be appreciated.
    --Ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Do not use default logger as getLoggers[0] , but use your java.util.Logger.FileHandler and add filehandler object to log your fButtonActions and you do not need to mess with logger.properties too.

  • How to use logger to send any output instead of the console?

    How to use logger to send any output instead of the console?

    How to use logger to send any output instead of the
    console?There are three commonly used logger inferfaces, the log4j, the java.util.loging and the Commons logging (which works with either.)
    You create a logger object, generally one for each class. Normally a private static variable points to it and it has a name equal to the FQN of the class.
    e.g.
    package org.widget;
    public class MyClass {
      private static   Logger log = Logger.getLogger("org.widget.MyClass");That's the java.uitil.Logger formula.
    Then there are method on the logger to call for various kinds of output. There' are different logging levels, priorities like SEVERE or DEBUG. When running the logs are configured to ignore messages of less than a set priority.
    You can also pass an Exception or Error to the logger which will log the stack trace.

  • Logger.getAnonymousLogger and log4j

    Hi all,
    We have developed an application with a combination of our own customized logger class called LogManager (which uses log4j) and java.util.Logger. This application is deployed in tomcat. All the java files have used both these classes for logging messages, a few in the error level and a few in the info level.Something like
    private static final LogManager logMgr = new LogManager(PDXDASImpl.class.getName());
    Logger.getAnonymousLogger().warning("In PDXDASImpl of "+tdaCurrentInstance+"-Incoming, pdRequest() : Method invoked at  :: "+date.toString());
    logMgr.logMessage("INFO", "-----Incoming TDA PDXDasImpl.java pdrequest-------------------------------");But only those the following code
    logMgr.logMessage("INFO", "-----Incoming TDA PDXDasImpl.java pdrequest-------------------------------");is logged into the log files which we have mentioned in the log.properties file. Since the application is huge and we dont want to replace the
    Logger.getAnonymousLogger().warning("")by
    logMgr.logMessage("WARN","");Please suggest some ways to log the messages into the Loggerfile mentioned in the log.properties
    Edited by: Kannan_S on Jul 16, 2009 5:26 AM
    Edited by: Kannan_S on Jul 16, 2009 5:27 AM

    how can I log the traces from DWR into the filesystem of an application instead of SystemOut.log (WebSphere)?First Google result for "dwr logging" is this: [http://directwebremoting.org/dwr/server/servlet/logging]
    And it says:
    if DWR discovers commons-logging then it will use that in place of servlet logging.So, you need to verify whether [Commons Logging|http://commons.apache.org/logging/] is present in your server, and put it there if it is.
    Then you need to determine the logging level of the DWR messages that you care about. It's probably "info" or "debug" rather than "warn".

  • Java loggers - append

    I'm am looking for a way to append to an already existing xml-style log file generated by java's logger class. Here is my setup:
    1 program runs as a thread, the thread loops every 5 minutes. If a fatal exception is caught, an entry is made in the xml file via java's logger class.
    another program monitors the first program. If a fatal exception causes the above program to exit, this monitor program restarts it. Therefore, I need a way to append to the already existing log file in the above program so it is not overwriten if this monitoring program restarts it.
    Oh, and please do not tell me to use "new FileHandler(LOG_FN, true)". This does not solve my problem. If you look carefully, you'll see that each time a handler is added to the logger, a new XML header is ALSO appended to the file. Obviously, I do not want this.

    There are other cases when this monitor would want to restart an individual program/process. Such as if the process is hung in an infinite loop or is no longer responding for some reason. This monitor will be in charge of checking over 140 programs, some of which were written poorly, before my time. Unfortunatly, I can't re-write 140 programs in one day, so, until I get around to re-writing them all, this is my solution.
    Now, back to my question...

  • Log4j: WARN No appenders could be found for logger

    Hi,
    I defined a log4j.properties file in my class directory:
    log4j.defaultInitOverride=false
    log4j.rootLogger=DEBUG, R, S
    log4j.appender.R=org.apache.log4j.RollingFileAppender
    log4j.appender.R.File=R.log
    log4j.appender.R.MaxFileSize=100KB
    log4j.appender.R.MaxBackupIndex=0
    log4j.appender.R.layout=org.apache.log4j.PatternLayout
    log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
    log4j.appender.S=org.apache.log4j.RollingFileAppender
    log4j.appender.S.File=S.log
    log4j.appender.S.MaxFileSize=100KB
    log4j.appender.S.MaxBackupIndex=0
    log4j.appender.S.layout=org.apache.log4j.PatternLayout
    log4j.appender.S.layout.ConversionPattern=%p %t %c - %m%n
    Then I used the Logger in loginAction.java:
    private Logger logger = Logger.getLogger("R");
    logger.setAdditivity(false);
    logger.info("LoginAction");
    and in OracleDAOFactory.java:
    private Logger logger = Logger.getLogger("S");
    logger.setAdditivity(false);
    logger.info("Connected to DB from customer DAO");
    what I want to achieve is to record the information for loginAction in R.log and record the information for OracleDAOFactory in S.log. But do NOT add loginAction's information into OracleDAOFactory, and vice versa.
    The above codes work properly if I remove the line "logger.setAdditivity(false);". However the result is both log files have the contents. But if I add the line "logger.setAdditivity(false);", I get the following error message:
    log4j:WARN No appenders could be found for logger (S).
    log4j:WARN Please initialize the log4j system properly.
    What is wrong with my above coding?
    Thanks for your help!

    I don't know if this applies to your situation, but I just resolved this problem in my own environment. It turns out, I was attempting to log something in an area of my code before the logger had been configured by calling the configure method of the PropertyConfigurator class and passing in the file name of the properties file as the argument. It's important to set up log4j before attempting to log to the output file, and I called a debug method before it was set up.

  • Logger lies to me

    This code says that it will print out FINE messages, but refuses to actually do it. Anybody know why?
    import java.util.logging.*;
    public class LoggerTest {
         public static void main( String[] args ) {
              Logger log = Logger.getLogger( LoggerTest.class.getName() );
              log.setLevel( Level.FINE );
              log.info ( "Will log fine? "+ log.isLoggable( Level.FINE ) );
              log.info   ( "Info " );
              log.fine   ( "Fine " );
              log.finer  ( "Finer " );
              log.finest ( "Finest " );
    }this is the output:
    java LoggerTest
    Jun 19, 2006 4:19:39 PM LoggerTest main
    INFO: Will log fine? true
    Jun 19, 2006 4:19:39 PM LoggerTest main
    INFO: Info

    java.util.Logging can be a bit tricky at first, but its very flexible. I used to always muck around with progammatic manipulation, too.
    The trick is to (choose 1 or more):
    a) Walk up the chain of parent loggers and configure all of them to log using Fine [ not too cool ]
    b) tell your logger not to use its parent (or you'll have duplicate messages) and add your own handler to it [ better, but still annoying ]
    c) obtain loggers from some utility class which does a or b [better]
    d) use the system properties to configure your applications loggers [better]
    Read up more on the architecture in java.util.logger.Logger and how to configure in java.util.logger.LogManager.

  • Using JConsole to Change Logger Level at runtime

    Is it possible to use JConsole to change Java's Logger logging level at runtime?
    If so could someone tell me how I could go about doing this?
    Thanks,

    Never mind, found a nice site to help out for this.
    http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html

Maybe you are looking for

  • My Pearl 8100 is not recognized by my Windows 7 computer and Desktop SW 6.0

    I cannot get my newly installed desktop software (v6.0) to detect my Pearl 8100 when I connect it through USB.  Upon the first software installation, it will recognize and sync once but after disconnecting and reconnecting, it will not detect.  I hav

  • High resolution video compression.

    I'm trying to compress a music video I shot through quicktime, and am not sure if I'm using the correct codec, (apple pro-res 422, 1280x720) When I do export the film, the quality is spectacular, but it won't export the entire video, just 3 of 6 minu

  • Sections of Publisher document are omitted in printing

    Photosmart is printing parts of document but not all.  Part of a box may be printed, the rest omitted.

  • Photoshop external scratch disk to improve performances?

    Hi I have performances issues with Photoshop CS2 (and with LightRoom) on a 2.16GHz Intel iMac (45GB free disk space). This is perhaps due in part to the Rosetta engine. Small files are OK to work with, but when it comes to several hundred MB files, e

  • PSE 12 thinks I'm opening a trial software that will expire

    I upgraded from PSE 8 to PSE 12, but every time I open PSE 12, it also opens Adobe Applications manager and asks me to sign in. When I close it, it asks if I'm sure I want to quit.  I click YES.  Then it lets me open PSE 12.  Lately it thinks I'm usi