@@ -126,16 +126,19 @@ defmodule Mix.Tasks.Compile.Elixir do
126
126
# Having compilations racing with other is most undesired,
127
127
# so we wrap the compiler in a lock. Ideally we would use
128
128
# flock in the future.
129
- Mix.State . lock ( __MODULE__ , fn ->
130
- Mix.Compilers.Elixir . compile (
131
- manifest ,
132
- srcs ,
133
- dest ,
134
- cache_key ,
135
- Mix.Tasks.Compile.Erlang . manifests ( ) ,
136
- Mix.Tasks.Compile.Erlang . modules ( ) ,
137
- opts
138
- )
129
+
130
+ with_logger_app ( project , fn ->
131
+ Mix.State . lock ( __MODULE__ , fn ->
132
+ Mix.Compilers.Elixir . compile (
133
+ manifest ,
134
+ srcs ,
135
+ dest ,
136
+ cache_key ,
137
+ Mix.Tasks.Compile.Erlang . manifests ( ) ,
138
+ Mix.Tasks.Compile.Erlang . modules ( ) ,
139
+ opts
140
+ )
141
+ end )
139
142
end )
140
143
end
141
144
@@ -149,6 +152,19 @@ defmodule Mix.Tasks.Compile.Elixir do
149
152
Mix.Compilers.Elixir . clean ( manifest ( ) , dest )
150
153
end
151
154
155
+ # Run this operation in compile.elixir as the compiler can be called directly
156
+ defp with_logger_app ( config , fun ) do
157
+ app = Keyword . fetch! ( config , :app )
158
+ logger_config_app = Application . get_env ( :logger , :compile_time_application )
159
+
160
+ try do
161
+ Logger . configure ( compile_time_application: app )
162
+ fun . ( )
163
+ after
164
+ Logger . configure ( compile_time_application: logger_config_app )
165
+ end
166
+ end
167
+
152
168
defp xref_exclude_opts ( opts , project ) do
153
169
exclude = List . wrap ( project [ :xref ] [ :exclude ] )
154
170
0 commit comments