I am writing a Java program and want to create a class that can be asked to create quick logs in CMD (I'm still in my testing phase, figuring out stuff) I have a file and a file that has a file.
-
LaunchProgram.java
-
help
-
Dbg.class
-
Dbg.java
-
LaunchProgram.class
(content which Relevant): Contents of importing:
Help in importing. DBG; Public class launch program {public static zero main (string [] args) {dbg ("test"); }}
Content of Dbg.class
:
Package Support; Public class dbg {public static zero main (string message) {System.out.println (message); }}
When I do javac Dbg.java
in the CMD, then Dbg.class
generates.
When I do javac LaunchProgram.java
in cmd, I get the following error:
Launch program. Java <>: Error: The symbol can not get DBG ("test"); ^ Symbol: Method DBG (String) Location: Class Launch Program
I'm not sure what has happened because of this, and I have seen this everywhere but the solution can not be found . Does anyone know what this problem is happening and how to fix it?
What you were trying to do right here:
public class launch program {public static zero main (string [] args) {Dbg.log ("test"); }} Public Category DBG {Public Static Zero Log (String Message) {System.out.println (Message); }}
But Apache log4j is a better way to enter your application. There is a skeleton code for your launch program
class that uses log4j to log a message:
import org.apache.logging.log4j. LogManager; Import org.apache.logging.log4j.Logger; Public class launch program {static final logger logger = log manager.getlogger (launch program.clash.jetname ()); Public static zero main (string [] args) {logger.info ("test"); }}
Note that you do not need a separate class to log, rather you can enter directly from the required class to enter a message.
No comments:
Post a Comment