Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding logs for easier debugging #615

Merged
merged 1 commit into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ public static boolean isTrue(String value) {
}
return false;
}

public static String getJavaVersion() {
return String.join(" - ", System.getProperty("java.home"), System.getProperty("java.version"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public FunctionEnvironmentReloadRequestHandler(JavaFunctionBroker broker) {

@Override
String execute(FunctionEnvironmentReloadRequest request, Builder response) throws Exception {
WorkerLogManager.getSystemLogger().log(Level.INFO, "FunctionEnvironmentReloadRequest received by the Java worker");
EnvironmentVariables = request.getEnvironmentVariablesMap();
if (EnvironmentVariables == null || EnvironmentVariables.isEmpty()) {
return String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.microsoft.azure.functions.worker.handler;

import java.util.*;
import java.util.logging.Level;

import com.microsoft.azure.functions.worker.WorkerLogManager;
import com.microsoft.azure.functions.worker.broker.*;
import com.microsoft.azure.functions.worker.description.*;
import com.microsoft.azure.functions.rpc.messages.*;
Expand All @@ -18,6 +20,7 @@ public FunctionLoadRequestHandler(JavaFunctionBroker broker) {

@Override
String execute(FunctionLoadRequest request, FunctionLoadResponse.Builder response) throws Exception {
WorkerLogManager.getSystemLogger().log(Level.INFO, "FunctionLoadRequest received by the Java worker");
final RpcFunctionMetadata metadata = request.getMetadata();
final FunctionMethodDescriptor descriptor = createFunctionDescriptor(request.getFunctionId(), metadata);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import com.microsoft.azure.functions.worker.broker.*;
import com.microsoft.azure.functions.rpc.messages.*;

import static com.microsoft.azure.functions.worker.Util.getJavaVersion;

public class InvocationRequestHandler extends MessageHandler<InvocationRequest, InvocationResponse.Builder> {
public InvocationRequestHandler(JavaFunctionBroker broker) {
super(StreamingMessage::getInvocationRequest,
Expand All @@ -23,6 +25,8 @@ public InvocationRequestHandler(JavaFunctionBroker broker) {

@Override
String execute(InvocationRequest request, InvocationResponse.Builder response) throws Exception {
WorkerLogManager.getSystemLogger().log(Level.INFO, "Java version - " + getJavaVersion());
WorkerLogManager.getSystemLogger().log(Level.INFO, "InvocationRequest received by the Java worker");
final String functionId = request.getFunctionId();
final String invocationId = request.getInvocationId();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.microsoft.azure.functions.rpc.messages.*;
import com.microsoft.azure.functions.worker.broker.JavaFunctionBroker;

import java.util.logging.Level;

public class WorkerInitRequestHandler extends MessageHandler<WorkerInitRequest, WorkerInitResponse.Builder> {
public WorkerInitRequestHandler(JavaFunctionBroker broker) {
super(StreamingMessage::getWorkerInitRequest,
Expand All @@ -15,6 +17,7 @@ public WorkerInitRequestHandler(JavaFunctionBroker broker) {

@Override
String execute(WorkerInitRequest request, WorkerInitResponse.Builder response) {
WorkerLogManager.getSystemLogger().log(Level.INFO, "WorkerInitRequest received by the Java worker");
broker.setWorkerDirectory(request.getWorkerDirectory());
response.setWorkerVersion(Application.version());
response.putCapabilities("TypedDataCollection", "TypedDataCollection");
Expand Down