Duplicate Service Initialization Logs in `effect-http` Application

I am using effect-http and have a core lib where I implement all my services. These services depend on other services, which I provide on the service directly. In the services I log that they have been initialised. But when I start the server, it logs that certain services are initialised multiple times. Is this expected or not?
// effect-http api
const AppLayer = Layer.mergeAll(
  Service1.Live,
  Service2.Live,
  Service3.Live
);

const app = RouterBuilder.make(api).pipe(
  // Add all the routes
);

app.pipe(
  Effect.tap(Effect.logInfo(`Visit: http://localhost:1337/docs#/`)),
  NodeServer.listen({ port: 1337 }),
  Effect.provide(AppLayer),
  NodeRuntime.runMain,
);


// example service
const make = Effect.gen(function* () {
  yield* Effect.log("Service1 initialised");
  // Service stuff
});

export class Service1 extends Context.Tag("core/Service1")<Service1, Effect.Effect.Success<typeof make>>() {
  static Live = Layer.effect(Service1, make).pipe(Layer.provide(Service2), Layer.provide(Service3));
}

and the output when running
[20:04:44.184] INFO (#16): Service1 initialised
[20:04:44.184] INFO (#16): Service1 initialised
[20:04:44.184] INFO (#16): Service2 initialised
[20:04:44.184] INFO (#16): Service2 initialised
[20:04:44.184] INFO (#16): Service3 initialised
[20:04:44.184] INFO (#16): Service3 initialised
[20:04:44.195] INFO (#0): Listening on http://0.0.0.0:1337
[20:04:44.195] INFO (#0): Listening on http://0.0.0.0:1337

(also not sure why "Listening on http://0.0.0.0:1337" is logged twice).
Was this page helpful?