WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.2% of users enabled 2FA.

Commit e723c4be authored by Kunshan Wang's avatar Kunshan Wang
Browse files

When run from C, log to stderr.

parent 816ca72b
package uvm.refimpl.nat;
import java.io.ByteArrayOutputStream;
import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.ConsoleAppender;
import uvm.refimpl.MicroVM;
import uvm.refimpl.MicroVM$;
/** Static functions for the convenient of C programs that start Mu via JNI. */
public class CInitiater {
private static boolean isLogConfigured = false;
private static void configureLog() {
if (isLogConfigured) {
return;
}
isLogConfigured = true;
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
lc.reset();
ConsoleAppender<ILoggingEvent> ca = new ConsoleAppender<ILoggingEvent>();
ca.setContext(lc);
ca.setName("console");
ca.setTarget("System.err");
PatternLayoutEncoder pl = new PatternLayoutEncoder();
pl.setContext(lc);
pl.setPattern("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n");
pl.start();
ca.setEncoder(pl);
ca.start();
Logger rootLogger = lc.getLogger(Logger.ROOT_LOGGER_NAME);
rootLogger.addAppender(ca);
}
/** Called by the native program, this function creates a Mu instance. */
static long mu_refimpl2_new() {
configureLog();
MicroVM mvm = new MicroVM(MicroVM$.MODULE$.DEFAULT_HEAP_SIZE(), MicroVM$.MODULE$.DEFAULT_GLOBAL_SIZE(),
MicroVM$.MODULE$.DEFAULT_STACK_SIZE());
long fak = NativeClientSupport$.MODULE$.exposeMicroVM(mvm);
......@@ -18,6 +56,7 @@ public class CInitiater {
* extra arguments.
*/
static long mu_refimpl2_new_ex(long heap_size, long global_size, long stack_size) {
configureLog();
MicroVM mvm = new MicroVM(heap_size, global_size, stack_size);
long fak = NativeClientSupport$.MODULE$.exposeMicroVM(mvm);
return fak;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment